Posts

Post not yet marked as solved
21 Replies
4.8k Views
Hey all, I am facing a weird issue when exporting my multi platform project. The project does not make use of the multi platform targets of Xcode yet. For each "module" in the app there exists two targets, one for iOS and one for watchOS. Each of these targets link agains a binary framework that is imported via SPM. Building works fine but as soon as I want to archive the project at the last step it complains that the Signature for the third party binary framework already exists. Which I think is a valid error message, but it seems to be a bug that the archive process either: Does not override it, which would be reasonable Or it should distinguish between the platforms Or should just not create two signature and just have one signature file created The error message I see “ThirdParty.xcframework.signature” couldn’t be copied to “Signatures” because an item with the same name already exists. Domain: NSCocoaErrorDomain Code: 516 Failure Reason: A file with the name “ThirdParty.xcframework.signature” already exists. Recovery Suggestion: To save the file, either provide a different name, or move aside or delete the existing file, and try again. -- The operation couldn’t be completed. File exists Domain: NSPOSIXErrorDomain Code: 17 Failure Reason: File exists -- System Information macOS Version 13.4.1 (Build 22F82) Xcode 15.0 (22221.2) (Build 15A5195k) Timestamp: 2023-07-08T12:43:57+02:00 A simplified project setup is like the following. ┌──────────────────────────────────────────────┐ │ SPM Package │ │ │ │ ┌────────────────────────┐ │ │ │ ThirdParty.xcframework │ │ │ └────────────────────────┘ │ │ │ │ └──────────────────────┼───────────────────────┘ ┌────────────┴───────────┐ ┌─────────┼────────────────────────┼───────────┐ │ │ CoreFramework │ │ │ ▼ ▼ │ │ ┌───────────────┐ ┌────────────────┐ │ │ │ iOS Target │ │ watchOS Target │ │ │ └───────────────┘ └────────────────┘ │ │ │ │ │ └─────────┼────────────────────────┼───────────┘ │ │ │ │ │ │ │ ▼ │ Embedded in ┌───────────────┐ │ (not ┌───│ watchOS App │ │ standalone) └───────────────┘ │ │ │ │ │ │ │ │ ▼ │ ┌─────────────────┐ │ │ iOS App │◀──┘ └─────────────────┘ I have the feeling it's rather a beta bug, but I wanted to ensure that's the case and its not me doing something wrong. Does anyone know if this setup is correct or if there is something I oversee here ? Any help is highly appreciated ! Feedback is also filed under: FB12373687
Posted Last updated
.
Post not yet marked as solved
11 Replies
2.3k Views
Hi, I am trying to integrate the new AppIntentsPackage protocol into my application. Especially what I want to do is to create a dedicate SPM package which holds all my app intents and then share that with my widget extension for Widget intents as well as the main iOS app for powering an AppShortcutProvider. Unfortunately I run into an issue here. I have the following explanatory setup: SPM package called ProjectAppIntents iOS target My AppIntents SPM package //Package: ProjectAppIntents public struct TestAppIntent: AppIntent { public static var title: LocalizedStringResource = "TestAppIntent" @Parameter(title: "Parameter1", optionsProvider: ParameterOptionProvider()) public var parameter: String public init(parameter: String) { self.parameter = parameter } public init() { } public func perform() async throws -> some IntentResult & ReturnsValue { .result(value: 5) } } struct ParameterOptionProvider: DynamicOptionsProvider { func results() async throws -> [String] { return ["Hello", "World"] } } public struct ProjectAppIntentsPackage: AppIntentsPackage { } My iOS app // Target: iOS import ProjectAppIntents struct ProjectApp: App { var body: some Scene { WindowGroup { ContentView() } } } extension ProjectApp: AppIntentsPackage { static var includedPackages: [AppIntentsPackage.Type] = [ ProjectAppIntentsPackage.self ] } struct ProjectShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: TestAppIntent(), phrases: ["Start a \(.applicationName)"], shortTitle: "Hello World", systemImageName: "house" ) } } When I now try to compile my app, I get the following build error: 2023-06-25 09:53:47.853 appintentsnltrainingprocessor[44848:2059163] Parsing options for appintentsnltrainingprocessor 2023-06-25 09:53:47.854 appintentsnltrainingprocessor[44848:2059163] Starting AppIntents SSU YAML Generation 2023-06-25 09:53:47.868 appintentsnltrainingprocessor[44848:2059163] error: The action TestAppIntent referenced in App Shortcut does not exist Command AppIntentsSSUTraining failed with a nonzero exit code So for me it seems like the compiler cannot find the AppIntent defined in an SPM package. Am I doing something wrong here or does the AppIntentsPackage protocol not work with SPM packages ? Thanks a lot for helping !
Posted Last updated
.
Post not yet marked as solved
4 Replies
2.7k Views
Hey, I am trying to save an enum in my model with SwiftData but getting a weird error message I do not understand at the moment, and I am pretty sure I am missing something here. public enum URLScheme: String, Codable { case https case http } @Model public class MyModel { public var urlScheme: URLScheme } When I try to save the model I get the following error message in the console: error: Row (pk = 1) for entity 'MyModel' is missing mandatory text data for property 'https' I was wondering if I need to tell SwiftData how to save my enum ? My assumption was that I can save any enum if it conforms to Codable. Am I doing something wrong here or is this a beta bug ? Thanks a lot for helping
Posted Last updated
.
Post not yet marked as solved
0 Replies
749 Views
Hey, I am currently trying to add deeplink handling from tapping on push notifications in my watchOS application with a SwiftUI lifecycle. I already have deeplinking working with several onOpenURL modifiers throughout the app for the iOS version. What I wanted to do, is whenever I receive a push notification I construct an URL and then utilise the onOpenURL view modifier to handle the deeplink. I currently struggle to understand if this is possible at all. I have the following setup @main struct WatchApp: App { @WKApplicationDelegateAdaptor var appDelegate: WatchAppDelegate // MARK: - Body var body: some Scene { WindowGroup { ContentView() } } } class WatchAppDelegate: NSObject, WKApplicationDelegate, ObservableObject { func applicationDidFinishLaunching() { UNUserNotificationCenter.current().delegate = self } } extension WatchAppDelegate: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { // handle the push notification } } I do receive the the notification as expected in userNotificationCenter(center:, didReceive:) but from there on I didn't find a way bring this information into my app. On iOS I do leverage UIApplication.shared.open(url:) but this is obviously not available on watchOS. What is the official guidance of handling watchOS deep links with SwiftUI lifecycle from tapping of push notifications ? Currently the onOpenURL modifiers are placed on several views, so it would be nice if there is a way to trigger them from a central place. Would be really appreciated if someone knows a way on how to do it :)
Posted Last updated
.