Thanks for the pointer, Quinn, but I'm afraid that doesn't answer my question. My app is using the "background audio mode" and successfully running in the background both when the device is unlocked & when it's locked. (I know it's running in the background because I can hear the audio it generates and see new statements in the log)
The problem is, even though my app is running in the background and pushing live activity content updates, iOS stops updating content after the screen is locked and doesn't resume until the user opens the app in the foreground. (Again, the app is running, generating audio, and log statements continually - it's ONLY the live activity that stops updating)
Below is the method I'm using to update the live activity:
fileprivate func updateLiveActivity(liveActivity:ActivityKit.Activity<LiveActivityAttributes>, contentState:LiveActivityAttributes.ContentState){
log.debug("LiveActivityManager.updateLiveActivity() with new ContentState")
Task{
await liveActivity.update( ActivityContent(state:contentState, staleDate:nil) )
}
}
A shown in the log above, I normally see my log.debug message immediately followed by an iOS generated "Updating content for activity " message, but the iOS update message only updates once after the protectedDataWillBecomeUnavailableNotification, so my live activity display is out of date until the user returns my app to the foreground.
Post
Replies
Boosts
Views
Activity
After looking at radiace72's the thread above I believe I've found a work-around: https://developer.apple.com/forums/thread/714984?answerId=732948022#732948022
In Simulator Version 14.0.1 (986.3) with iOS 16.0, you CAN download voices...but it doesn't always work the first time.
When you first create a simulator (here I created an iOS 16 simulator on an iPhone 11), going to Settings > Accessibility > Spoken Content doesn't include an option to download voices, even if you enable Speak Selection and click under Voices: all you see is an empty screen under Voices.
BUT if you kill settings and reopen it, then go back to Spoken Content, enable Speak Selection, click Voices you'll be presented with a list of languages and the ability to download voices below that.
(I created an animated GIF movie of the simulator behavior, but the forum won't let me add it here)
Downloading voices might not always work in Simulator Version 14.0.1 (986.3) with iOS 16.0.
When you first create a simulator (here I created an iOS 16 simulator on an iPhone 11), going to Settings > Accessibility > Spoken Content doesn't include an option to download voices, even if you enable Speak Selection and click under Voices: all you see is an empty screen under Voices.
BUT if you kill settings and reopen it, then go back to Spoken Content, enable Speak Selection, click Voices you'll be presented with a list of languages and the ability to download voices below that.
(I created an animated GIF movie of the simulator behavior, but the forum won't let me add it here)
I haven't circled back to iOS 16 with my speech app, but I did discover one additional bit of information: I get nasty errors failing to get an AVSpeechSynthesisVoice when my app target is set to "Any iOS Device (arm64)". This happened the other day when I unplugged my physical device then Xcode defaulted back to "Any iOS Device (arm64)", and a SwiftUI canvas preview was trying to run in the background.
Update: the problem persists in Xcode 14 beta 2. As shown below, Xcodes Platform Download, doesn't show iOS 15.5 as an option to download, and it doesn't show it as being installed
Prior to upgrading to beta 2, I deleted both the original Xcode and the first beta, as well all the Xcode config files I could find online including:
/Applications/Xcode-beta.app
~/Library/Caches/com.apple.dt.Xcode
~/Library/Developer
~/Library/MobileDevice
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Preferences/com.apple.dt.xcodebuild.plist
/Library/Preferences/com.apple.dt.Xcode.plist
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.bom
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.plist
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
/private/var/db/receipts/com.apple.pkg.Xcode.bom
Update: this appears to be an iOS 16 issue. Using the iOS 15.5 simulator, the above code works fine.