Post

Replies

Boosts

Views

Activity

Initial sync of watchOS app using Core Data and CloudKit
I have an existing iOS/watchOS app that uses a third-party database and WatchConnectivity. For various reasons I am migrating the app to use Core Data with CloudKit. I have everything working using NSPersistentCloudKitContainer. Sync between the iOS and watchOS app are working on my test devices when I start with an empty database. However, I need to import existing user's data when they first install this new version. Some users may have hundreds or thousands of records, but the total database size is under 1-2MB. Data migration/import is working on the iOS side, the Core Data entities are populated on first launch and uploaded to CloudKit (I see in the debug logs that a NSPersistentCloudKitContainer.Event export ends successfully). The problem is launching the watchOS app does not sync the data from CloudKit. I see a import started event but never see it end. I never see any Core Data entities appear on watchOS even after waiting several minutes and re-opening the Watch app multiple times. New entities or modifications made on either app are also not synced. Is the problem just too much data which causes the CloudKit sync to never finish? What are the best practice to populate a watchOS app with initial data from the parent iOS app and keep it in sync with CoreData/CloudKit?
3
1
946
Sep ’23
Xcode 11.7 Failed to prepare device for development
Since updating my iPhone to iOS 13.7 and Xcode to 11.7 I am unable to connect my iPhone as a development device. Under "Errors and Warnings" in the "Devices" window, I see "Failed to prepare device for development.", details below. I have tried relaunching Xcode, rebooting iMac and rebooting iPhone and reconnecting the iPhone multiple times with no luck. Any suggestions? Failed to prepare device for development. Domain: com.apple.dtdevicekit Code: 806 Recovery Suggestion: If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device. User Info: {   AssociatedMobileDeviceFunction = AMDeviceMountImage;   DVTRadarComponentKey = 487927;   NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running."; }- Could not allocate a resource. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653181 User Info: {   DVTRadarComponentKey = 261622;   MobileDeviceErrorCode = "(0xE8000003)";   "com.apple.dtdevicekit.stacktrace" = ( 0  DTDeviceKitBase           0x0000000120d7181a DTDKCreateNSErrorFromAMDErrorCode + 233 1  DTDeviceKitBase           0x0000000120db08a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034 2  DTDeviceKitBase           0x0000000120db15e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779 3  libdispatch.dylib          0x00007fff6adfa658 _dispatch_client_callout + 8 4  libdispatch.dylib          0x00007fff6ae066ec _dispatch_lane_barrier_sync_invoke_and_complete + 60 5  DTDeviceKitBase           0x0000000120db127a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199 6  IDEiOSSupportCore          0x0000000120c11741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265 7  DVTFoundation            0x00000001071cc5c4 DVT_CALLING_CLIENT_BLOCK + 7 8  DVTFoundation            0x00000001071d145b __DVTDispatchGroupAsync_block_invoke + 1194 9  libdispatch.dylib          0x00007fff6adf96c4 _dispatch_call_block_and_release + 12 10 libdispatch.dylib          0x00007fff6adfa658 _dispatch_client_callout + 8 11 libdispatch.dylib          0x00007fff6adfc890 _dispatch_continuation_pop + 534 12 libdispatch.dylib          0x00007fff6adfbf16 _dispatch_async_redirect_invoke + 703 13 libdispatch.dylib          0x00007fff6ae08957 _dispatch_root_queue_drain + 326 14 libdispatch.dylib          0x00007fff6ae09097 _dispatch_worker_thread2 + 92 15 libsystem_pthread.dylib       0x00007fff6b0549f7 _pthread_wqthread + 220 16 libsystem_pthread.dylib       0x00007fff6b053b77 start_wqthread + 15 ); }- System Information macOS Version 10.15.6 (Build 19G2021) Xcode 11.7 (16142)
3
0
5.6k
Sep ’20