Post

Replies

Boosts

Views

Activity

Reply to How to get notified on CKError.quotaExceeded
Thank you for your reply. I have tried something like the following, however the "quotaExceeded" never gets printed even though the above error message does. I can see also that the code enters the .partialFailure section of the if, however ckerror.partialErrorsByItemID is always nil or an empty list. Any suggests on how to unpack the error and get to the underlying .quotaExceeded? class SyncMonitor { /// Where we store Combine cancellables for publishers we're listening to, e.g. NSPersistentCloudKitContainer's notifications. fileprivate var disposables = Set<AnyCancellable>() init() { NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification) .sink(receiveValue: { notification in print("notification: \(notification)") if let cloudEvent = notification.userInfo?[NSPersistentCloudKitContainer.eventNotificationUserInfoKey] as? NSPersistentCloudKitContainer.Event { // NSPersistentCloudKitContainer sends a notification when an event starts, and another when it // ends. If it has an endDate, it means the event finished. if cloudEvent.endDate == nil { print("Starting an event...") // You could check the type, but I'm trying to keep this brief. } else { switch cloudEvent.type { case .setup: print("Setup finished!") case .import: print("An import finished!") case .export: print("An export finished!") @unknown default: assertionFailure("NSPersistentCloudKitContainer added a new event type.") } if cloudEvent.succeeded { print("And it succeeded!") } else { print("But it failed!") } if let error = cloudEvent.error { print("Error: \(error.localizedDescription)") guard let ckerror = error as? CKError else { return } print("Error: code: \(ckerror.code), \(ckerror.localizedDescription)") if ckerror.code == .partialFailure { guard let errors = ckerror.partialErrorsByItemID else { return } for (_, error) in errors { if let currentError = error as? CKError { print(currentError.localizedDescription) } } } else if ckerror.code == .quotaExceeded { print("quotaExceeded") } } } } }) .store(in: &disposables) } }
Jan ’24
Reply to iOS 17.4 SwiftUI .toolbar(.hidden, for: .tabBar) not work
I've run into all sorts of problems with .toolbar/.tabBar in iOS 17.4 which suddenly stopped working right after over a year of unchanged code. In the end I came up with this convoluted code where I use a @Binding to control the .hidden/.visible state of the tab bar, and set the variable in various .onAppear/.onDisappear handlers.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to How to get notified on CKError.quotaExceeded
Thank you for your reply. I have tried something like the following, however the "quotaExceeded" never gets printed even though the above error message does. I can see also that the code enters the .partialFailure section of the if, however ckerror.partialErrorsByItemID is always nil or an empty list. Any suggests on how to unpack the error and get to the underlying .quotaExceeded? class SyncMonitor { /// Where we store Combine cancellables for publishers we're listening to, e.g. NSPersistentCloudKitContainer's notifications. fileprivate var disposables = Set<AnyCancellable>() init() { NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification) .sink(receiveValue: { notification in print("notification: \(notification)") if let cloudEvent = notification.userInfo?[NSPersistentCloudKitContainer.eventNotificationUserInfoKey] as? NSPersistentCloudKitContainer.Event { // NSPersistentCloudKitContainer sends a notification when an event starts, and another when it // ends. If it has an endDate, it means the event finished. if cloudEvent.endDate == nil { print("Starting an event...") // You could check the type, but I'm trying to keep this brief. } else { switch cloudEvent.type { case .setup: print("Setup finished!") case .import: print("An import finished!") case .export: print("An export finished!") @unknown default: assertionFailure("NSPersistentCloudKitContainer added a new event type.") } if cloudEvent.succeeded { print("And it succeeded!") } else { print("But it failed!") } if let error = cloudEvent.error { print("Error: \(error.localizedDescription)") guard let ckerror = error as? CKError else { return } print("Error: code: \(ckerror.code), \(ckerror.localizedDescription)") if ckerror.code == .partialFailure { guard let errors = ckerror.partialErrorsByItemID else { return } for (_, error) in errors { if let currentError = error as? CKError { print(currentError.localizedDescription) } } } else if ckerror.code == .quotaExceeded { print("quotaExceeded") } } } } }) .store(in: &disposables) } }
Replies
Boosts
Views
Activity
Jan ’24
Reply to How to resubmit an In-App Purchase for review
In case anyone else runs into this - I updated the Display Name of my IAP to something else, hit save, and then changed the Display Name back to what was there originally. Now the IAP is back in review. Sure seems like a "resubmit" button would be a lot more intuitive.
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Apr ’22