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
Replies
Boosts
Views
Activity
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.
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?
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?
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.
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.
Hi, after watching the WWDC session What’s new in App Store Connect, I was curious if the new deep linking feature allows for additional query parameters to be passed to the app. For example an app with sharing, I would want a custom product page that relates to sharing but also for the user to see the specific shared content (based on an ID in the url). Is that possible?
Xcode 16, iOS 18 official release. On both my phone and simulator, when I build the release build of my app, when I go to control center and select "Add a Control", springboard crashes (see attached crash log).
Somehow this does not happen in debug config, with debug config (which does have a different bundle ID but everything else is the same) I'm able to add the control widget just fine.
The widget code is taken directly from the Apple docs:
struct WidgetTestWidgetControl: ControlWidget {
static let kind: String = "com.myapp.WidgetTestWidget"
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: Self.kind,
provider: Provider()
) { value in
ControlWidgetToggle(
"Start Timer",
isOn: value.isRunning,
action: StartTimerIntent(value.name)
) { isRunning in
Label(isRunning ? "On" : "Off", systemImage: "timer")
}
}
.displayName("Timer")
.description("A an example control that runs a timer.")
}
}
extension WidgetTestWidgetControl {
struct Value {
var isRunning: Bool
var name: String
}
struct Provider: AppIntentControlValueProvider {
func previewValue(configuration: TimerConfiguration) -> Value {
WidgetTestWidgetControl.Value(isRunning: false, name: configuration.timerName)
}
func currentValue(configuration: TimerConfiguration) async throws -> Value {
let isRunning = true // Check if the timer is running
return WidgetTestWidgetControl.Value(isRunning: isRunning, name: configuration.timerName)
}
}
}
struct TimerConfiguration: ControlConfigurationIntent {
static let title: LocalizedStringResource = "Timer Name Configuration"
@Parameter(title: "Timer Name", default: "Timer")
var timerName: String
}
struct StartTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Start a timer"
@Parameter(title: "Timer Name")
var name: String
@Parameter(title: "Timer is running")
var value: Bool
init() {}
init(_ name: String) {
self.name = name
}
func perform() async throws -> some IntentResult {
// Start the timer…
return .result()
}
}
However in a fresh project I am able to add this widget code and it works completely fine in both debug and release. How can I fix this?
This is clearly affecting many apps and is the 'fault' of the app, see these threads:
https://www.reddit.com/r/ios/comments/1fiqrd7/ios_18_control_center_keeps_crashing_when_trying/
https://discussions.apple.com/thread/255759997?sortBy=rank
crash-log.txt