Post

Replies

Boosts

Views

Activity

App Intent in separate target doesn't work
Made a separate target for App Intents, but I don't get it to work. The intent is shown in the Shortcuts app when registered using AppShortcutsProvider. But upon running the intent it gives this error: Error Domain=LNActionFor- AutoShortcutPhraseFetchError Code=1 "No AutoShortcuts instance registered." UserInfo={NSLocalizedDescription=No AutoShortcuts instance registered.} I've attached a sample project to my FA-post FB10199299
5
1
2.3k
Jun ’22
Accept CKShare with SwiftUI App lifecycle
In iOS 15, macOS 12, tvOS 15 and watchOS 8 we can finally share NSManagedObjects using NSPersistentCloudKitContainer 🎉 I've been playing around with it and I've managed to share an object from one Apple ID to another. But I'm unable to accept the invite. 😰 If I understand the docs correctly I'm supposed to call func acceptShareInvitations(…) with CKShare.Metadata representing the invite. This metadata should be forwarded to my app using either AppDelegate or SceneDelegate. The problem is that I'm using the SwiftUI App-protocol. I tried setting up an UIApplicationDelegateAdaptor with this code: ivar added @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate AppDelegate implemented class AppDelegate: NSObject, UIApplicationDelegate {     func application(_ application: UIApplication, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {         assertionFailure()     } } The assertionFailure is never called, so my guess is that the SceneDelegate is being called instead. So, how do I implement the following two SceneDelegate-calls in an app that uses the SwiftUI App lifecycle? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {         assertionFailure()     } func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {         assertionFailure()     }
0
0
752
Jun ’21