I have encountered a problem about AppEntity and AppIntent shortcut. Here is what i have done.
I created some shortcuts use AppShortcutsProvider. Each shortcut created by AppEntity.
I search my app name in spotlight, so these shortcut can be shown in the spotlight.
I don't click the shortcut and back to home screen. Then I delete these shortcuts by modify the Entity.defaultQuery and call AppShortcutsProvider.updateAppShortcutParameters()
Going back to the spotlight, I can see my previous query and result. When I clicked the shortcut, I got an error WFBackgroundShortcutRunnerErrorDomain
Should the spotlight result need to be refreshed when i come back to it?
Post
Replies
Boosts
Views
Activity
Hi, I'm trying to implement the iOS18 ControlWidget features. When i turn on a ControlWidgetToggle that action with a LiveActivityIntent, the toggle will turn off automatic. The toggle state is read from my sharemanger, but it state won't refresh even i use the ControlCenter.shared.reloadAllControls(). Here is my code.
struct TimerLiveActivityControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: Self.kind) {
ControlWidgetToggle(isOn: ShareManager.shared.isLiveActivityTimerOn, action: LiveActivityTimerIntent()) { isTurnedOn in
Image(systemName: isTurnedOn ? "fan.fill":"fan")
Text(isTurnedOn ? "Turned off" : "Turned On")
} label: {
Text("Live Activity Timer")
}
}
}
}
struct LiveActivityTimerIntent: LiveActivityIntent, SetValueIntent {
static var title: LocalizedStringResource { "Live Activity timer" }
@Parameter(title: "is Turned On")
var value: Bool
@MainActor
func perform() async throws -> some IntentResult {
TimerLiveActivityTimer.shared.duration = 10
TimerLiveActivityTimer.shared.startTimer()
return .result()
}
}
func startTimer() {
self.startActivity()
self.isLiveActivityTimerOn = true
Timer.scheduledTimer(withTimeInterval: TimeInterval(self.duration), repeats: false) { timer in
self.isLiveActivityTimerOn = false
ControlCenter.shared.reloadAllControls()
self.endActivity()
}
//The ControlWidgetToggle can't refresh even i refresh it all time
Timer.scheduledTimer(withTimeInterval: TimeInterval(0.1), repeats: true) { timer in
ControlCenter.shared.reloadAllControls()
}
}
However the code can work if I use a single SetValueIntent.
My Xcode version is 16.0 beta, use iOS 18.0 simulator.
APP Intent is generated through the "Extract app intents metadata" swift compiled step, thus make it difficult to delete. Is there any API can delete an APP Intent at runtime instead of wait for the version release ?
Hello, I have applied background assets on my app. It does allow you to download resources in advance, increasing the speed of resource presentation. But I found that the download success rate was only 20% (Within an app with tens of millions of users). And most of the error codes are:
BAErrorDomain Code=111 "The requested download could not be enqueued. Check the device‘s Low Power Mode or Background App Refresh settings" .
Generally speaking, the proportion of low power mode should be around 20%. So why are there so many 111 error codes
I have run the demo "Food Truck", which implement the AppShortcut. I found that the shortcuts need to be added to shortcut and can't to be search in the spotlight even I had make sure it is "suggest in search"
iOS 17.0 simulator