If your iOS app uses UILocalNotifications, you (and your users) may be wondering why you haven't been receiving them after updating iOS 5. It seems that due to a bug (or is it undocumented feature?) in iOS 5, Local Notifications now behave a lot more like Push Notifications.
By default, if your app does not register for push notifications, it will not be in the Notification Center and thus unable to send notifications (remote or local). Of course your users can always manually go into Settings -> Notifications and hunt down your app, but not all users will realize this and - as in our case - many may think your app is 'broken' in iOS 5.
Until Apple (hopefully) releases an update to fix this, a workaround is to register your app to receive Remote/Push Notifications (even if you don't use them) so that your app is "in" the Notification Center and able to receive Local Notifications. To do this, in your App Delegate's application didFinishLaunchingWithOptions method, add the following:
- // Workaround for iOS5 bug. We need to register for remote notifications,
- // otherwise all notifications are disabled by default in the Notification Center
- [[UIApplication sharedApplication]
- UIRemoteNotificationTypeBadge |
- UIRemoteNotificationTypeAlert |
At startup, your app will now prompt the user to receive push notifications and when they accept, join the ranks of other Push Notification apps in the Notification Center.