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.
Post
Replies
Boosts
Views
Activity
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)
}
}
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.
Thanks! CloudKit wasn't on my radar for this. I'll check it out.
I probably should have provided example code. Suppose I have a SwiftUI View like this:struct MyView: View {
var body: some View {
Button(action: {
print("A")
}) {
Text("A")
}
Button(action: {
print("B")
}) {
Text("B")
}
}
}This accepts touches on A and B presented on the screen and causes the associated action closures to run. How would I accept an external physical keyboard press of A or B to cause the code in the closures to run?