objective c - IOS8 Push Notifications -
I'm trying any registered iPad for push notifications without luck. I have tried the following code but received an error on the iOS 8 "RegisterForremote Notification Type: IOS 8.0 and later is not supported." Although its work is fine on iOS7.
- (BOOL) application: (UIApplication *) FinishLaunchingWithOptions the application: (NSDictionary *) Launch Option {CGRect screen Bounds = [[UScreen main screen] limit]; If ([[[Uaidiwais current device] system immersion] float value]> gt; = 8.0) {Anselog (@ "++++++++++++++"); [[UIApplication shared application] Register user notification settings: [UIUserNotificationSettings SettingsForTypes: (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories: zero]]; [[UIApplication shared applicant] registerForRemoteNotifications]; } And {nslog (@ "============"); [[UIApplication Sajaanupryog] Rjistrformotiteshn follows: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; }
Better way: if ([[UIApplication sharedApplication] respondsToSelector: @selector (registerUserNotificationSettings :)]) {// iOS 8 Notifications // use registerUserNotificationSettings [[UIApplication sharedApplication] registerUserNotificationSettings: [UIUserNotificationSettings settingsForTypes: (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories : Zero]]; [[UIApplication shared applicant] registerForRemoteNotifications]; } Else {// IOS & lt; 8 notifications // Register Foreremoteshn notification [[Uaiapiplikeshn share Aplifikeshn] Bad type Rjistrforeremot notification type: Uairmot notification | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert]; }
Comments
Post a Comment