Post

Replies

Boosts

Views

Activity

Widget Intent Definition: Can I define a parameter with multiple values that has fixed size 0 for small widget?
My widget's layout is like: /* Small */ HStack { 		BigItemA 		BigItemB } /* Medium */ VStack { 		HStack { 				BigItemA 				BigItemB 		} 		HStack { 				SmallItemA 				SmallItemB 				SmallItemC 		} } I want to configure this widget in this way: /* Small */ BigItemA -> What? BigItemB -> What? /* Medium */ BigItemA -> What? BigItemB -> What? SmallItemA -> What? SmallItemB -> What? SmallItemC -> What? So I add two parameters in my custom intent, and checked Supports multiple values and Fixed size. For big items, everything is ok, I just set array size to be 2 at every widget size. However, for the small items, when I make the array size to be 0 in small widget size, I get an alert: Array size must be a positive number. How can I implement this requirement in intent definition?
1
0
1.8k
Sep ’20
Resume long lived operation failed with error CKDatabaseOperations must be submitted to a CKDatabase
After upgrading to iOS 15 beta 4, several users report the app crashes shortly when launch. Debug in the device, we had the same crash: *** Terminating app due to uncaught exception 'CKException', reason: 'CKDataBaseOperations must be submitted to a CKDatabase' The user info in this CKError leads us to this line: // Called when app launches final class PrivateDatabaseManager { let container: CKContainer let database: CKDatabase public init(container: CKContainer) { self.container = container self.database = container.privateCloudDatabase } func resumeLongLivedOperationIfPossible() { container.fetchAllLongLivedOperationIDs { [weak self]( opeIDs, error) in guard let self = self, error == nil, let ids = opeIDs else { return } for id in ids { self.container.fetchLongLivedOperation(withID: id, completionHandler: { [weak self](ope, error) in guard let self = self, error == nil else { return } if let modifyOp = ope as? CKModifyRecordsOperation { modifyOp.modifyRecordsCompletionBlock = { (_,_,_) in print("Resume modify records success!") } self.container.add(modifyOp) } }) } } } } If we add a break point in this line, the properties in modifyOp look fine. and we don't have this issue before this beta. Checking the crash data we collect in firebase, the operating system is 100% iOS 15. Using: Xcode: Version 13.0 beta 3 (13A5192j) Device: 15.0 (19A5307g)
7
1
1.8k
Jul ’21
Donate widget configuration intent with INInteraction failed: Cannot donate interaction with intent that has no valid shortcut types
Do I need to check Intent is eligible for Siri Suggestions before donate it with INInteraction? But I only want to donate this intent so Siri can add my widget to Smart Stack, not in Lock Screen or other places. Intent Definition: Intent is eligible for widgets Intent is user-configurable in the Shortcuts app and Add to Siri Intent is eligible for Siri Suggestions Donate Intent: let widgetIntent = MyWidgetConfigurationIntent() widgetIntent.range = .weekly // Configure my intent let interaction = INInteraction(intent: intent, response: nil) interaction.donate { error in if let error = error { // Error: Code=1901 "Cannot donate interaction with intent that has no valid shortcut types" } }
1
0
1.5k
Sep ’21
Xcode 13.3 failed to compile project deploy to iOS 11.0 with Intent definition contains custom types, error: 'Type' is only available in iOS 12.0 or newer.
My project deploy target is iOS 11.2, I have an intent file for widget supports, which contains a custom type. The project works with Xcode 13.2.1, when using Xcode 13.3 beta (13E5086k), the generated file contains an extra extension without available decorator, which cause a compile time error: 'IntentType' is only available in iOS 12.0 or newer public extension IntentType {     override class var supportsSecureCoding: Bool { true } } Compile project using Xcode 13.2.1: Compile project using Xcode 13.3: I've composed a new feedback with a sample project: FB9889772 (Xcode 13.3 failed to compile project deploy to iOS 11.0 with Intent definition contains custom types, error: 'IntentClass' is only available in iOS 12.0 or newer.)
2
0
1.6k
Feb ’22
Can I read FamilyActivitySelection the container app saved in the Device Activity Report Extension?
In the container app, use FamilyActivityPicker to select some categories & applications, and set a limit usage time. save the result in UserDefaults. in the DeviceActivityMonitor extension, read the saved selection to present the shield. it works. in the DeviceActivityReportScene extension, read the saved selection, in the report add a special icon for categories & applications with limited usage time. it does not work. in the third step, I can read the saved selection, but I can't match the selected data with DeviceActivityResults in the makeConfiguration function.
1
0
1.6k
Jul ’22
Can't update Live Activity from app with ActivityKit when app is running in the background with background audio playing.
I had a timer app, it played white noise after starting the timer. so my app is running in the background with background audio, and the timer is perfect for display with live activity. However, when I test my code with a real device, I find calling await activity.update(using: contentState) when app is running in the background does not work at all. the code executes, but the live activity won't get updated. After some experiments, I find: if the app is running in the background with background location or Picture-in-picture mode, the app can update live activity when running in the background. If the app is running in the background with audio playing, it will work on simulator, but not on a real device. I submit a feedback: FB11683922 (Can't update Live Activity from app with ActivityKit when app is running in the background with background audio playing.) My code is like: func startLiveActivity() { // Prepare content state and attributes.     do {       self.activity = try Activity.request(attributes: activityAttributes, contentState: initialContentState) // Play audio so app can keep running in the background.       try playAudio()     } catch (let error) {       print("Error requesting Live Activity \(error.localizedDescription).")     }   } private func playAudio() throws {     try AVAudioSession.sharedInstance().setCategory(.playback, options: .mixWithOthers)     try AVAudioSession.sharedInstance().setActive(true)     if self.player == nil {       if let url = Bundle.main.url(forResource: "Forest", withExtension: "m4a") {         player = try AVAudioPlayer(contentsOf: url)         player?.numberOfLoops = -1       }     }     player?.stop()     player?.currentTime = 0     player?.play()   } after the timer stops, the code will execute, but the live activity won't get updated.   func updateActivity(){     Task {       if let activity = self.activity { // Prepare content state         await activity.update(using: contentState)       }     }   }
20
7
7.1k
Oct ’22
Xcode 15 beta 2: Failed to install iOS app with widget extension to simulator or device, because widget extension is does not define either an NSExtensionMainStoryboard or NSExtensionPrincipalClass key with a string value in the NSExtension dictionar
Xcode: Version 15.0 beta 2 (15A5161b) iPhone: iOS 17.0 (21A5268h) Run from Xcode to Simulator or my iPhone, build successfully, install failed with the same error: My widget extension target info.plist file looks like the image below, and it worked find with all the previous Xcode version. After adding the key NSExtensionPrincipalClass like this: I can install my app to simaltor and my device, however, when archive and upload to the App Store (for TestFlight testing), i got another error (the first one is related to this issue, the second i could not figure out what it is):
3
1
2.0k
Jun ’23