Post

Replies

Boosts

Views

Activity

Reply to Can't accept CloudKit share invitation from my SwiftUI application
I implemented the userDidAcceptCloudKitShareWith… in the SceneDelegate, and set up the scene delegate as such: class AppDelegate { // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { let config = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) config.delegateClass = SceneDelegate.self return config } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) { let acceptShareOperation = CKAcceptSharesOperation(shareMetadatas: [cloudKitShareMetadata]) acceptShareOperation.qualityOfService = .userInteractive acceptShareOperation.perShareResultBlock = { meta, result in guard let recordID = meta.hierarchicalRootRecordID else { return } // do the things… } acceptShareOperation.acceptSharesResultBlock = { result in // N/A } CKContainer(identifier: cloudKitShareMetadata.containerIdentifier).add(acceptShareOperation) } }
Topic: App & System Services SubTopic: iCloud Tags:
Aug ’24
Reply to CoreData sharing/collaboration feature is broken
I've often wondered how NSPersistentCloudKitContainer.share… works, and your example goes a long way to explaining it. When you identify the objects you want to share, they get moved to a new zone. and that zone is what is shared. but the API probably wasn't designed to handle the scenario you describe, so once a record is moved to a shared zone, it doesn't/can't get move to another zone. 2¢
Topic: App & System Services SubTopic: iCloud Tags:
Aug ’24
Reply to CoreData persistent history tracking with legacy stack and Objective C
is the question, you are building a new version of your app and want to load an existing store from an old version, and also enable history, does that work and what are the implications? My suggestion is to build a test app, define a core data schema, run the app, generate and save some test data, quit the app, enable the history bit, and launch again, does the call to load stores fail in some way? and if it succeeds, when you add new data, what does the history show?
Topic: Community SubTopic: Apple Developers Tags:
Jul ’24
Reply to SceneKit app randomly crashes with EXC_BAD_ACCESS in jet_context::set_fragment_texture
random crashes, imo, often mean threading issues, and indeed what you shared shows a crash in thread 2 with several other threads running as well. FWIW, early in my SceneKit days, I experienced similar crashes, and solved it by refactoring my code to add and remove SCNNodes only in main thread. fwiw.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Can't accept CloudKit share invitation from my SwiftUI application
I implemented the userDidAcceptCloudKitShareWith… in the SceneDelegate, and set up the scene delegate as such: class AppDelegate { // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { let config = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) config.delegateClass = SceneDelegate.self return config } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) { let acceptShareOperation = CKAcceptSharesOperation(shareMetadatas: [cloudKitShareMetadata]) acceptShareOperation.qualityOfService = .userInteractive acceptShareOperation.perShareResultBlock = { meta, result in guard let recordID = meta.hierarchicalRootRecordID else { return } // do the things… } acceptShareOperation.acceptSharesResultBlock = { result in // N/A } CKContainer(identifier: cloudKitShareMetadata.containerIdentifier).add(acceptShareOperation) } }
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to CoreData sharing/collaboration feature is broken
I've often wondered how NSPersistentCloudKitContainer.share… works, and your example goes a long way to explaining it. When you identify the objects you want to share, they get moved to a new zone. and that zone is what is shared. but the API probably wasn't designed to handle the scenario you describe, so once a record is moved to a shared zone, it doesn't/can't get move to another zone. 2¢
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to Walking with AR (phone or Vision passthrough)
there are several open source libraries that use location… like https://github.com/AndrewHartAR/ARKit-CoreLocation
Topic: Spatial Computing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to The recommended way of handling CoreData+CloudKit errors
and finally, read TN3164: Debugging the synchronization of NSPersistentCloudKitContainer
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to The recommended way of handling CoreData+CloudKit errors
then read TN3163: Understanding the synchronization of NSPersistentCloudKitContainer
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to The recommended way of handling CoreData+CloudKit errors
start with TechNote 3162: Understanding CloudKit Throttles
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to Prevent wiping out all records when user disables iCloud sync for the app
I suspect that all apps using NSPersistentCloudKitContainer will behave the same way? If this genuinely surprises end-users, then it's on Apple to address, not you.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to EXC_CRASH from NSManagedObjectContext executeFetchRequest
are you doing anything with core data in background threads?
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to CoreData persistent history tracking with legacy stack and Objective C
is the question, you are building a new version of your app and want to load an existing store from an old version, and also enable history, does that work and what are the implications? My suggestion is to build a test app, define a core data schema, run the app, generate and save some test data, quit the app, enable the history bit, and launch again, does the call to load stores fail in some way? and if it succeeds, when you add new data, what does the history show?
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to CloudKit user 'throttling'
also, in case you haven't found this yet… https://developer.apple.com/documentation/technotes/tn3162-understanding-cloudkit-throttles
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to CloudKit user 'throttling'
is your code kicking off 100 CKModifyRecordsOperations simultaneously? yes, assume any CloudKit operation can receive a throttling error and respond as needed
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to SwiftData via CloudKit Only Syncing Upon Relaunch
In the "Signing and Capabilities" section of your app target, make sure you add the "Background Modes" capability and enable "Remote notifications" https://developer.apple.com/documentation/swiftdata/syncing-model-data-across-a-persons-devices
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Using Core Data with the Swift 6 language mode
fwiw, I'm still getting up to speed on Swift concurrency, but I suspect that NSManagedObject is most definitely not sendable.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to How to addObserver for currentPlaybackTime for the system music player?
you can register for notifications of the player for events such as starting, stopping, pausing, etc. While the music player is playing, you'll want to set up a Timer to periodically update a progress bar. In SwiftUI you can use the TimelineView to periodically update the progress bar. https://developer.apple.com/documentation/swiftui/timelineview
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’24