Post

Replies

Boosts

Views

Activity

IntentDonationManager not donating Shortcuts
if #available(iOS 16.0, *) {       print("donated")       let intent = BasicIntent()       IntentDonationManager.shared.donate(intent: intent)    } Trying to test if donations work with the new App Intents framework. Donating the shortcut once a user taps a button. The shortcut is not appearing on the lock screen. Everything else is working as expected. The Shortcut is appearing in the Shortcuts App and is working via Siri. In developer settings I have Display Recent Shortcuts -> On Display Donations on Lock Screen -> On Allow Any domain -> On Allow Unverified sources -> On Running iOS 16.2, iPhone 11.
5
2
1.9k
Jan ’23
App Intent Not Appearing in Shortcuts App
I'm on Xcode 14.2 and running iOS 16.2 on my device (No betas). The intent does not appear in the shortcuts App. Here's my code.. import AppIntents @available(iOS 16.0, *) struct ShowRecentOrder: AppIntent {   static var title: LocalizedStringResource = "Show my orders"   static var description = IntentDescription("Shows list of orders")   @MainActor   func perform() async throws -> some IntentResult & ProvidesDialog {     let total = await getRecentOrder()     let dialog = IntentDialog(total)     return .result(dialog: dialog)   }   private func getRecentOrder() async -> LocalizedStringResource {     let result = await OrderServiceMock.fetchRecentOrder()     return LocalizedStringResource(stringLiteral: String(format: "%2.f", result))   } } @available(iOS 16.0, *) struct ShortcutsService: AppShortcutsProvider {   // Maximum of 10 App Shortcuts supported by Apple   @AppShortcutsBuilder static var appShortcuts: [AppShortcut] {     AppShortcut(       intent: ShowRecentOrder(),       phrases: [         "Show my recent order in \(.applicationName)",         "View my recent order in \(.applicationName)"       ]     )   }   static var shortcutTileColor: ShortcutTileColor { .tangerine } } class OrderServiceMock {   static func fetchRecentOrder() async -> String {     let mockOrders = ["Order 1", "order 2", "Order 3"]     return mockOrders.randomElement() ?? ""   } }
3
1
1.5k
Dec ’22