Post

Replies

Boosts

Views

Activity

SwiftData CloudKit integration requires that all attributes be optional, or have a default value set
After install XCode 15 beta 6: @Model class WordResult { var text = "" var translation:[String] = [] init(){ } } got this error: Variable 'self._$backingData' used before being initialized so I changed to : @Model class WordResult { var text:String var translation:[String] init(){ self.text = "" self.translation = [] } } Then got this: CloudKit integration requires that all attributes be optional, or have a default value set It seems it can not work with cloudkit now.
5
3
2.2k
Aug ’23
WidgetKit watch complication not shown on real device.
I updated my project from watch app + extension to single-execute project with Xcode 15. Then add a widget target to watch app. The new WidgetKit swiftUI complications works well on simulator, but not shown on the real device.(can not find on Apple Watch Face Complication Editor or rectangle widget) I tried: clean xcode build && Derived Data. reboot my watch/iphone delete all old clockkit complication settings & complicationcontroller.swift the watch still show old clockkit complicaton , that very buggy. so I try next: 4. restore my watch and pair it again. The new WidgetKit complication still not shown, it very frustrated. Do I have to change my old watch app to swiftUI lifecycle project to work? But code is works onthe simulator, which doesn't make sense. when I debug widget extension on Xcode, it show error: SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'hltek.***.watchkitapp.ComplicationWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo={NSLocalizedFailureReason=No widgets available to reload}}}}, FBSOpenApplicationRequestID=0x16e7}." UserInfo={NSUnderlyingError=0x15684f10 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo=0x1567e360 (not displayed)}}}, FBSOpenApplicationRequestID=0x16e7}}, NSLocalizedDescription=Failed to show Widget 'hltek.***.watchkitapp.ComplicationWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.Carousel" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (IOSSHLMainWorkspace) for reason: BadArgument., NSLocalizedDescription=The request to open "com.apple.Carousel" failed., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x15687310 {Error Domain=FBSOpenApplicationErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x15696b00 {Error Domain=com.apple.Carousel.ComplicationExtensionDebuggingErrorDomain Code=3 "No widgets available to reload" UserInfo={NSLocalizedFailureReason=No widgets available to reload}}}}, FBSOpenApplicationRequestID=0x16e7}.} Domain: DTXMessage Code: 1 User Info: { DVTErrorCreationDateKey = "2023-07-06 03:36:45 +0000"; } -- System Information macOS Version 13.4.1 (Build 22F2083) Xcode 15.0 (22221.2) (Build 15A5195k) Timestamp: 2023-07-06T11:36:45+08:00 dyld[459]: Symbol not found: _$s21DeveloperToolsSupport15PreviewRegistryPAAE7previewAA0D0VvgZ Referenced from: <E835EDE1-190A-33B0-9462-EFD25999365D> /private/var/containers/Bundle/Application/F2DE6431-DF97-472D-934F-B2B3F76E660E/*** WatchKit App.app/PlugIns/ComplicationWidgetExtension.appex/ComplicationWidgetExtension Expected in: <E4C8E0EA-CF6C-381C-877C-716427DD3DFB> /System/Library/Frameworks/DeveloperToolsSupport.framework/DeveloperToolsSupport debug the extension on simulator with no error.
2
1
1.4k
Jul ’23
How to implement vertical scroll page on watchOS with SwiftUI
I want to implement a vertical scroll page like system workout app. Now I can get a similar effect with this:     TabView {       page1         .rotationEffect(.degrees(90))       page2         .rotationEffect(.degrees(90))     }.tabViewStyle(.page(indexDisplayMode: .automatic))     .rotationEffect(.degrees(-90)) But not good as system workout app does. It supports digital crown and dynamic show indicator and custom color. So , how to implement that vertical scroll effect?
1
0
1.3k
Oct ’22
Remove node from ARSCNView cause random crash(btCollisionWorld::updateSingleAabb)
I made a ball drop animation on the ARSCNView, then after 1 second, then deleted the ball and re-added it to the original position on the view, but this occasionally crashes. something like this: private func dropBall(){ // do ball dropping animation let randomX = Float.random(in: -2...2) * 0.001 let randomY = Float.random(in: 3...10) * 0.001 ballNode?.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil) ballNode?.physicsBody?.mass = 0.005 let position = SCNVector3(x: 0.05, y: 0.05, z: 0.05) let force = SCNVector3(x: randomX, y: randomY , z: 0) ballNode?.physicsBody?.applyForce(force, at: position, asImpulse: true) let tv = SCNVector4(x: -0.2 + Float(0.4 * randomCGFloat()), y: 0 , z: 0.2, w: 0) ballNode?.physicsBody?.applyTorque(tv, asImpulse: true) //remove the ball DispatchQueue.main.asyncAfter(deadline: .now() + 1){ self.ballNode?.physicsBody = nil self.ballNode?.removeFromParentNode() self.ballNode = nil // add ball again let ballNode = SCNReferenceNode(named: "myscn.scn") contentNode?.addChildNode(ballNode) self.ballNode = ballNode } } crash stack: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000068 Exception Codes: 0x0000000000000001, 0x0000000000000068 VM Region Info: 0x68 is not in any region. Bytes before following region: 68719476632 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> commpage (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated) Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [30984] Triggered by Thread: 11 Thread 11 name: Thread 11 Crashed: 0 SceneKit 0x00000001cf3ef998 btDbvtBroadphase::setAabb(btBroadphaseProxy*, btVector3 const&, btVector3 const&, btDispatcher*) + 52 1 SceneKit 0x00000001cf65126c btCollisionWorld::updateSingleAabb(btCollisionObject*) + 284 2 SceneKit 0x00000001cf65133c btCollisionWorld::updateAabbs() + 56 3 SceneKit 0x00000001cf3ff39c btCollisionWorld::performDiscreteCollisionDetection() + 32 4 SceneKit 0x00000001cf406964 btDiscreteDynamicsWorld::internalSingleStepSimulation(float) + 120 5 SceneKit 0x00000001cf3ff574 btDiscreteDynamicsWorld::stepSimulation(float, int, float) + 276 6 SceneKit 0x00000001cf507ad8 -[SCNPhysicsWorld _step:] + 156 (SCNPhysicsWorld.mm:1423) 7 SceneKit 0x00000001cf3ae9fc -[SCNRenderer _update:] + 932 (SCNRenderer.m:3814) 8 SceneKit 0x00000001cf3ae364 -[SCNRenderer _drawSceneWithNewRenderer:] + 152 (SCNRenderer.m:5303) 9 SceneKit 0x00000001cf3ae278 -[SCNRenderer _drawScene:] + 40 (SCNRenderer.m:5537) 10 SceneKit 0x00000001cf3a78b4 -[SCNRenderer _drawAtTime:] + 500 (SCNRenderer.m:5727) 11 SceneKit 0x00000001cf3a74cc -[SCNView _drawAtTime:] + 368 (SCNView.m:1542) 12 SceneKit 0x00000001cf4ba478 __83-[NSObject(SCN_DisplayLinkExtensions) SCN_setupDisplayLinkWithQueue:screen:policy:]_block_invoke + 44 (SCNDisplayLink_ARC.m:42) 13 SceneKit 0x00000001cf595fa0 -[SCNDisplayLink _displayLinkCallbackReturningImmediately] + 148 (SCNDisplayLink.m:381) 14 libdispatch.dylib 0x0000000190a267c8 _dispatch_client_callout + 16 (object.m:560) 15 libdispatch.dylib 0x00000001909fde7c _dispatch_continuation_pop$VARIANT$armv81 + 436 (inline_internal.h:2632) 16 libdispatch.dylib 0x0000000190a0f860 _dispatch_source_invoke$VARIANT$armv81 + 1552 (source.c:596) 17 libdispatch.dylib 0x0000000190a0172c _dispatch_lane_serial_drain$VARIANT$armv81 + 308 (inline_internal.h:0) 18 libdispatch.dylib 0x0000000190a022e4 _dispatch_lane_invoke$VARIANT$armv81 + 380 (queue.c:3940) 19 libdispatch.dylib 0x0000000190a0c000 _dispatch_workloop_worker_thread + 612 (queue.c:6846) 20 libsystem_pthread.dylib 0x00000001d0f3cb50 _pthread_wqthread + 284 (pthread.c:2618) 21 libsystem_pthread.dylib 0x00000001d0f3c67c start_wqthread + 8 How to fix this? This will only crash by chance and is not too easy to reproduce, is there a problem with me deleting this node in this way?
1
0
1.1k
Sep ’22
MusicKit can't play the playlist which created by myself in iOS 16 beta 7,error:Queue descriptor was not provided
Playlist 1: created by myself, id: pl.u-BNA6rpjIRXy7Dj https://music.apple.com/cn/playlist/i-jump-you-jump/pl.u-BNA6rpjIRXy7Dj Playlist 2: created by Apple Music, id:pl.e1bd354664a743d1ad3e10db21118dc7 https://music.apple.com/cn/playlist/jumping-rope/pl.e1bd354664a743d1ad3e10db21118dc7 When I play list 1: Failed to play with error: Error Domain=MPMusicPlayerControllerErrorDomain Code=1 "Queue descriptor was not provided." UserInfo={NSDebugDescription=Queue descriptor was not provided.}. It works well on iOS 15, but has this error on iOS 16 beta6 and beta7. The list2 works well both on iOS 15 and iOS 16 let tracks = try await loadTracks("pl.u-BNA6rpjIRXy7Dj") // not works, pl.e1bd354664a743d1ad3e10db21118dc7 this id works ApplicationMusicPlayer.shared.queue = ApplicationMusicPlayer.Queue(for: tracks) Task { do { try await ApplicationMusicPlayer.shared.play() } catch { print("Failed to play with error: \(error).") } } func loadTracks(plId:String) async throws -> MusicItemCollection<Track> { let playlistRequest = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: MusicItemID(rawValue: plId)) let playlistResponse = try await playlistRequest.response() if let playlist = playlistResponse.items.first { let detailedPlaylist = try await playlist.with([.tracks]) let tmpTracks = detailedPlaylist.tracks ?? [] return tmpTracks } else { print("Couldn't find playlist.") return [] } } FB: FB11426046
1
0
1.4k
Sep ’22
Cannot get Nintendo Switch Joycon accelerator motion data in iOS 16
Now I am using iOS 16 beta 6, I can get buttonA/buttonB is pressed event. but cannot get accelerator motion data info.      //work     buttonA?.valueChangedHandler = {(_ button: GCControllerButtonInput, _ value: Float, _ pressed: Bool) -> Void in       print(">>> ButtonA tapped")     }     //work     buttonB?.valueChangedHandler = {(_ button: GCControllerButtonInput, _ value: Float, _ pressed: Bool) -> Void in       print(">>> ButtonB tapped")     }           // this is not works     gameController.motion?.valueChangedHandler = { (motion: GCMotion)->() in       print(">>>> motion data \(motion.acceleration.x) \(motion.acceleration.y) \(motion.acceleration.z)")       if let delegate = self.motionDelegate {         delegate.motionUpdate(motion: motion)       }     } Is there any plan to support this?
4
3
2.7k
Aug ’22
iOS 16 Live Activities cann't be refreshed in the background ?
I tried this: https://developer.apple.com/documentation/activitykit/displaying-live-data-on-the-lock-screen-with-live-activities I am building a workout app, the app can run in background , and I want to update the Live Activity realtime(once a second ) , so users can see the workout progress in realtime. But as I test, when app in foreground the activity widget refreshed perfectly. But when the app goes to the background, it is not refreshed.
8
5
4.3k
Jul ’22
SwiftUI render wrong size on old devices like Apple Watch Series 4
Problem: SwiftUI render wrong size on old device like Apple Watch Series 4. The height was be cut, not well render as series 6 or simulator. Check the screenshots. BTW: But it works well both on watch series 6 real device or simulator. Reproduce: Download “Build a Workout App for Apple Watch”, run the code on a real device of watch series 4 https://developer.apple.com/videos/play/wwdc2021/10009/ On Watch4-44 mm (first line be clip) On Simulator or watch 6.
0
0
935
Sep ’21
WatchKit: -[SPRemoteInterface _registerInterfaceController:interfaceControllerID:interfaceControllerClientID:applicationRootController:] crash
There are many crash logs collected when fire a local custom notification on watchOS. But everything works fine in both real device and simulator tests. Any suggestion thanks. WatchKit: -[SPRemoteInterface registerInterfaceController:interfaceControllerID:interfaceControllerClientID:applicationRootController:] + 268 Exception Type: EXCCRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXCCORPSENOTIFY Triggered by Thread: 0 Related LevelUpNotificationController code: class LevelUpNotificationController: WKUserNotificationInterfaceController {   @IBOutlet var lblLvl: WKInterfaceLabel!   override init() {     super.init()   }       override func willActivate() {     super.willActivate()   }       override func didDeactivate() {     super.didDeactivate()   }           override func didReceive(_ notification: UNNotification, withCompletion completionHandler: @escaping (WKUserNotificationInterfaceType) -> Swift.Void) {     print(">>> didReceive withCompletion")     let userInfo = notification.request.content.userInfo           if let lvl = userInfo["level"] as? Int {       self.lblLvl.setText("\(lvl)")     }     completionHandler(.custom)   }           @available(watchOSApplicationExtension 5.0, *)   override func didReceive(_ notification: UNNotification) {     super.didReceive(notification)     os_log(">>>didReceive: LevelUpNotificationController didReceive")     let userInfo = notification.request.content.userInfo     WKInterfaceDevice().play(.notification)     if let lvl = userInfo["level"] as? Int {       self.lblLvl.setText("\(lvl)")     }   } } crash log - https://developer.apple.com/forums/content/attachment/45d08ff4-51b5-44cc-a821-2f960d25174d
0
0
992
Jun ’20
WatchOS AVSpeechSynthesizer, Snapshot watchdog transgression.
I collect a lot of crash logs seem like this, but it seems that users are not affected by these crashes. How it happened? I find a clue about this, libAXSpeechManager.dylib&#9;&#9;&#9; 0x6e31adbc -[AXSpeechThread main] + 368 (AXSpeechThread.m:50) All crashes has Text to Speech function. my related code:    func speak(_ announcement: String,preDelay:TimeInterval = 0, endDelay:TimeInterval = 0,lan:String = "", rate:Float = AVSpeechUtteranceDefaultSpeechRate,didFinish:((_ str:String)->Void)? = nil) {     DispatchQueue.global(qos: .background).async {               let utterance = AVSpeechUtterance(string: announcement.lowercased())       utterance.volume = 2.0       if(lan.count > 0){         utterance.voice = AVSpeechSynthesisVoice(language:lan)       }       utterance.preUtteranceDelay = preDelay       utterance.postUtteranceDelay = endDelay       utterance.rate = rate               if let callback = didFinish {         self.synth.speakUtterance(utterance){           synth,utt in           callback("\(utt.speechString)")         }       } else {         self.synth.speak(utterance)       }     }   } AVSpeechSynthesizer in watchOS seems easy to cause bugs. Any suggest ? Thank you for help. Incident Identifier: 235EFDB7-B276-4EA6-9FA8-4D624017F1EA CrashReporter Key:&#9; a52074c6e7cd936048b907e2e6eec067f1578b41 Hardware Model:&#9;&#9;&#9;Watch2,6 Process:&#9;&#9;&#9;&#9;&#9;&#9; YaoYao WatchKit Extension [408] Path:&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/private/var/containers/Bundle/Application/0841E854-BF20-4E7A-8BB0-5FB99B3F289D/YaoYao WatchKit App.app/PlugIns/YaoYao WatchKit Extension.appex/YaoYao WatchKit Extension Identifier:&#9;&#9;&#9;&#9;&#9;hltek.YaoYao.watchkitapp.watchkitextension Version:&#9;&#9;&#9;&#9;&#9;&#9; 2 (2.2.7) AppVariant:&#9;&#9;&#9;&#9;&#9;1:Watch2,6:6 Code Type:&#9;&#9;&#9;&#9;&#9; ARM (Native) Role:&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Non UI Parent Process:&#9;&#9;&#9;launchd [1] Coalition:&#9;&#9;&#9;&#9;&#9; hltek.YaoYao.watchkitapp.watchkitextension [423] Date/Time:&#9;&#9;&#9;&#9;&#9; 2020-06-14 08:40:35.2580 +0800 Launch Time:&#9;&#9;&#9;&#9; 2020-06-14 08:38:42.0000 +0800 OS Version:&#9;&#9;&#9;&#9;&#9;Watch OS 6.2.5 (17T608) Release Type:&#9;&#9;&#9;&#9;User Baseband Version:&#9;&#9;n/a Report Version:&#9;&#9;&#9;104 Exception Type:&#9;EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note:&#9;EXC_CORPSE_NOTIFY Termination Reason: CAROUSEL, Snapshot watchdog transgression. Exhausted CPU time allowance of 2.00 seconds. Elapsed total CPU time (seconds) 6.22 (user 6.22, system 0.00), 60% CPU. Elapsed application CPU time (seconds) 2.48, 25% CPU. Termination Description: SPRINGBOARD, CSLSceneSnapshotAction watchdog transgression: xpcservice&lt;hltek.YaoYao.watchkitapp.watchkitextension&gt;:408:408 exhausted CPU time allowance of 2.00 seconds | &lt;FBExtensionProcess: 0x15ad8e90; xpcservice<hltek.YaoYao.watchkitapp.watchkitextension&gt;:408:408; typeID: com.apple.watchkit> Elapsed total CPU time (seconds): 6.220 (user 6.220, system 0.000), 62% CPU | Elapsed application CPU time (seconds): 2.484, 25% CPU, lastUpdate 2020-06-14 00:40:29 +0000 Triggered by Thread:&#9;0 Thread 0 name: Thread 0 Crashed: 0&#9; libsystem_kernel.dylib&#9;&#9;&#9;&#9; 0x4243b6f8 semaphore_wait_trap + 8 1&#9; libdispatch.dylib&#9;&#9;&#9;&#9;&#9;&#9; 0x422f7188 _dispatch_sema4_wait + 12 (lock.c:139) 2&#9; libdispatch.dylib&#9;&#9;&#9;&#9;&#9;&#9; 0x422f7612 _dispatch_semaphore_wait_slow + 104 (semaphore.c:132) 3&#9; FrontBoardServices&#9;&#9;&#9;&#9;&#9;&#9; 0x45a4f576 -[FBSSceneSnapshotRequestHandle performRequestForScene:] + 418 (FBSSceneSnapshotRequestHandle.m:67) 4&#9; FrontBoardServices&#9;&#9;&#9;&#9;&#9;&#9; 0x45a53b5c -[FBSSceneSnapshotAction snapshotRequest:performWithContext:] + 218 (FBSSceneSnapshotAction.m:168) 5&#9; FrontBoardServices&#9;&#9;&#9;&#9;&#9;&#9; 0x45a0f070 -[FBSSceneSnapshotRequest performSnapshotWithContext:] + 276 (FBSSceneSnapshotRequest.m:65) Thread 6 name: Thread 6: 0&#9; libsystem_kernel.dylib&#9;&#9;&#9;&#9; 0x4243b6a8 mach_msg_trap + 20 1&#9; libsystem_kernel.dylib&#9;&#9;&#9;&#9; 0x4243ad7a mach_msg + 42 (mach_msg.c:103) 2&#9; CoreFoundation&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x4277a4a0 __CFRunLoopServiceMachPort + 106 (CFRunLoop.c:2575) 3&#9; CoreFoundation&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x4277649a __CFRunLoopRun + 1026 (CFRunLoop.c:2931) 4&#9; CoreFoundation&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x42775dfc CFRunLoopRunSpecific + 326 (CFRunLoop.c:3192) 5&#9; Foundation&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x43057a58 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 180 (NSRunLoop.m:374) 6&#9; libAXSpeechManager.dylib&#9;&#9;&#9; 0x6138adbc -[AXSpeechThread main] + 368 (AXSpeechThread.m:50) 7&#9; Foundation&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x43158308 NSThreadstart__ + 708 (NSThread.m:724) 8&#9; libsystem_pthread.dylib&#9;&#9;&#9; 0x424c9236 _pthread_start + 130 (pthread.c:896) 9&#9; libsystem_pthread.dylib&#9;&#9;&#9; 0x424cff50 thread_start + 20 [crash 1](https://developer.apple.com/forums/content/attachment/e45cca8c-69bf-4c9a-adef-2f42458844e7){: .log-attachment}
1
0
1.2k
Jun ’20