I have an application that uses local notifications. In iOS 7, everything works fine, but in iOS 8, the application should ask the user for permission to display notifications. To request permission in iOS 8, I use:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; }
It works fine in Xcode 6 and iOS 8. When I open the same project in Xcode 5, the error is a semantic problem. "Use of undeclared identifier" UIUserNotificationSettings "."
How can I make the application work with iOS 7 and 8 and work correctly with notifications in both versions.
ios objective-c xcode
dannysandler Jul 25 '14 at 1:31 2014-07-25 01:31
source share