From 1b2ffe13d83d6e5a8feaba9996ddaad7596ce94b Mon Sep 17 00:00:00 2001 From: zhangqinghe Date: Wed, 24 Sep 2014 20:33:55 +0800 Subject: [PATCH] fix document --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 660e891..1287586 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,28 @@ self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; // Required - [APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | - UIRemoteNotificationTypeSound | - UIRemoteNotificationTypeAlert)]; - // Required - [APService setupWithOption:launchOptions]; + #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1 +    if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) { +     //可以添加自定义categories +     [APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | +                                                    UIUserNotificationTypeSound | +                                                    UIUserNotificationTypeAlert) +                                        categories:nil]; +   } else { +     //categories 必须为nil +     [APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | +                                                    UIRemoteNotificationTypeSound | +                                                    UIRemoteNotificationTypeAlert) +                                        categories:nil]; + #else +     //categories 必须为nil +   [APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | +                                                  UIRemoteNotificationTypeSound | +                                                  UIRemoteNotificationTypeAlert) +                                      categories:nil]; + #endif +     // Required +     [APService setupWithOption:launchOptions]; return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {