Post

Replies

Boosts

Views

Activity

Spotlight App shortcut can't refresh when refresh the AppEntity
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?
2
0
229
Oct ’24
ControlWidgetToggle can't be refresh when it action with a LiveActivityIntent.
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.
1
0
477
Aug ’24
Too many BAErrorDomain Code=111 \"The requested download could not be enqueued. Check the device‘s Low Power Mode or Background App Refresh settings.
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
0
0
363
May ’24