Post not yet marked as solved
Ever since using Xcode 14 SDK to compile, the iOS keyboard takes a long, variable, time to appear when focusing a UITextField or UITextView. I can confirm that using the previous SDK, the notification keyboardWillShow fires instantly, while in the current 14 SDK it takes a considerable amount of time, and not just the first time the keyboard opens. It always dismisses instantly.
Is there any way to make the keyboard appear more quickly? Sometimes UI needs to move in sync with the keyboard and we need to know the keyboard height ASAP so it doesn't feel delayed.
Even without needing the notification sooner, my app feels more delayed in general since selecting a text view takes longer for the keyboard to appear. Is there any way to debug why, or speed this up? It seems in the Notes app the keyboard appears instantly.
Post not yet marked as solved
I have a feature in my app which is very similar to native Clock alarms, where users can set a time for a reminder and optional days of the week to repeat the reminder.
Example Case
User sets a reminder at 1:00 PM, repeating every day. I schedule 7 notifications, 1 for each weekday, each repeating. The user should get a notification every day at 1:00 PM unless they turn off the feature.
Problem
After successfully scheduling local notifications, and it working for the first day, the notifications stop working and printing pending notifications shows that they mysteriously got unscheduled.
What I know I've heard of a 64 limit to notifications, but when testing with 7 notifications (1 reminder for each day of the week, repeating) it doesn't work either.
Each notification has an ID in the format:
<my bundle id>.<UUIDstring>
It consistently works on the first day, then fails on the 2nd or 3rd day
The app is in production, the problem occurs in both development and production environments.
Code
for day in self.days {
/*
days is an array of integers representing weekdays
*/
let content = UNMutableNotificationContent()
content.title = "Practice \(profile.name)"
content.categoryIdentifier = "reminder"
content.sound = UNNotificationSound.default
var dateComponents = DateComponents()
dateComponents.weekday = day
dateComponents.hour = Calendar.current.component(.hour, from: self.date)
dateComponents.minute = Calendar.current.component(.minute, from: self.date)
dateComponents.second = 0
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
/*
id(for:) generates a unique id using a UUID and the weekday.
*/
let request = UNNotificationRequest(identifier: id(for: day), content: content, trigger: trigger)
center.add(request) { (error) in
print(error) /*never an error here*/
}
}
The code seems to work exactly as intended; printing pending notifications shows 7 repeating notifications on different days as expected. However after a few days it stops working, and printing pending notifications shows no pending notifications.
I really need to get this resolved. Any ideas?
Post not yet marked as solved
I am transitioning to using CloudKit for syncing, using NSPersistentCloudKitContainer to manage syncing. In my app you can record audio, and I've been saving that by saving the file to disc and storing a relative URL to Core Data.
How can I get this to work using NSPersistentCloudKitContainer? I read that I shouldn't store large data as a CoreData attribute for performance, but I need the data to sync with CloudKit.
Post not yet marked as solved
I'm using NSPersistentCloudKitContainer to sync my Core Data stack with iCloud. I have one model that I want to be local to the device - how would I exclude that model from being synced while making sure it is saved to the device?
Post not yet marked as solved
I'm adding iCloud sync using NSPersistentCloudKitContainer to my production app. When the user firsts downloads the app, they are prompted to create a profile (they basically just choose an icon representing something). There's no email address or anything, and the user can create multiple profiles to track different things.
Now that there's iCloud sync, if a user downloads the app on an iPad after using it on their phone, they are still prompted to create a profile. There's no way around this as far as I can tell, because you cannot manually trigger a sync and it sometimes takes a full 5 minutes for NSPersistentCloudKitContainer to decide to sync.
How do I handle the UX of this? I don't want the user to have to create a new profile and then delete/merge it once the data comes in, but I can't rely on iCloud syncing in time to handle this case. Any advice would be really appreciated.
Post not yet marked as solved
I'm using Core Data and NSPersistentCloudKitContainer to sync the data using iCloud. There is some data that I want to just be local to the device, how would I make a CoreData model that is not synced with the cloud?