Post

Replies

Boosts

Views

Activity

Reply to How to get notified on CKError.quotaExceeded
I am testing the same thing with a user that has a maxed out iCloud storage. The eventChangedNotification received only mentions a partialFailure without any CKPartialErrorsByItemIDKey so there doesn't seem to be a way to come to the conclusion that the issue is with the storage quota being exceeded just by listening those notifications, is there? Is the only way trying to manually write to cloudkit and analysing the error received? If so, why is there a .quotaExceeded code for the notifications? *** debugDescription print of the notification: NSPersistentCloudKitContainer.eventChangedNotification received: name = NSPersistentCloudKitContainerEventChangedNotification, object = Optional(), userInfo = Optional([AnyHashable("event"): <NSPersistentCloudKitContainerEvent: 0x300d186e0> { type: Export store: C947EFBD-BE17-49EF-807B-087A62EBF0DE started: 2024-06-13 01:39:23 +0000 ended: 2024-06-13 01:39:28 +0000 succeeded: NO error: CKErrorDomain:2 }]) *** debug output from console: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _recoverFromPartialError:forStore:inMonitor:] 2812: <NSCloudKitMirroringDelegate: 0x301114870>: Error recovery failed because the following fatal errors were found: { "<CKRecordID: 0x302e99dc0; recordName=61920C45-377E-4E1F-BD51-8E4E0D290B59, zoneID=com.apple.coredata.cloudkit.share.3DA846A5-15EC-409D-9160-E1764FFA74BC:defaultOwner>" = "<CKError 0x302090f90: "Quota Exceeded" (25/2035); server message = "Quota exceeded"; op = ADC86A29FF3777F8; uuid = 7C016545-FF26-4B11-B475-A15B770DDC25; Retry after 344.0 seconds; container ID = "xxxx">"; [...]
2w
Reply to Testing out App Intents and running into some issues
The counter variable you are referring to is not the instance you see displayed on screen when running the app => ContentView().counter One solution would be to have ContentView observe a singleton which you can call from your AppIntent. For example: @main struct CounterApp: App {     var body: some Scene {         WindowGroup {             ContentView(counter: Counter.shared)         }     } } struct ContentView: View {     @ObservedObject var counter: Counter          var body: some View {         VStack {             Text("Counter")                 .font(.title)             Text(String(counter.value))                 .font(.title)                 .padding()                          HStack {                 Button(action: {                     counter.decrementCounter()                 }, label: {                     Image(systemName: "minus")                         .font(.title.bold())                         .frame(minHeight: 30)                 })                 .controlSize(.large)                 .buttonStyle(.borderedProminent)                 .tint(.red)                 .padding(.trailing)                                  Button(action: {                     counter.incrementCounter()                 }, label: {                     Image(systemName: "plus")                         .font(.title.bold())                         .frame(minHeight: 30)                 })                 .controlSize(.large)                 .buttonStyle(.borderedProminent)                 .tint(.green)                              }             .padding()         }     } } class Counter: ObservableObject {     static let shared = Counter()     @Published var value: Int = 0          func decrementCounter() {         if value > 0 {             value -= 1         }     }          func incrementCounter() {         if value <= 9999 {             value += 1         }     } } @available(iOS 16, *) struct SiriAddOne: AppIntent {     static var title: LocalizedStringResource = "Add 1"     static var description = IntentDescription("Adds 1 to the counter")          static var openAppWhenRun: Bool = true     static var parameterSummary: some ParameterSummary {         Summary("Adds 1 to the counter")     }          @MainActor     func perform() async throws -> some IntentResult {         Counter.shared.incrementCounter()         return .result(dialog: "Okay, added 1 to counter.")     } }
Oct ’22