diff --git a/NotifyMe/NMAppDelegate.m b/NotifyMe/NMAppDelegate.m index 55544c3..6679810 100644 --- a/NotifyMe/NMAppDelegate.m +++ b/NotifyMe/NMAppDelegate.m @@ -17,7 +17,6 @@ @implementation NMAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Register with ContextHub #ifdef DEBUG // The debug flag is automatically set by the compiler, indicating which push gateway server your device will use // Xcode deployed builds use the sandbox/development server @@ -30,18 +29,17 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // Register the app id of the application you created on https://app.contexthub.com [ContextHub registerWithAppId:@"YOUR-PUSH-APP-ID-HERE"]; - // Register for remote notifications -#ifdef __IPHONE_8_0 - // iOS 8 and above - UIUserNotificationType notificationTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; - UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; - [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; -#else - // iOS 7 and below - UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; - [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; -#endif + if ([UIUserNotificationSettings class]) { + // iOS 8 and above + UIUserNotificationType notificationTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; + UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; + [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; + } else { + // iOS 7 and below + UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; + [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; + } // Clear badge application.applicationIconBadgeNumber = 0; diff --git a/NotifyMe/NotifyMe-Info.plist b/NotifyMe/NotifyMe-Info.plist index 53a07c2..42ea076 100644 --- a/NotifyMe/NotifyMe-Info.plist +++ b/NotifyMe/NotifyMe-Info.plist @@ -2,8 +2,6 @@ - NSLocationAlwaysUsageDescription - NotifyMe needs to use background location updates for location changes to work correctly. CFBundleDevelopmentRegion en CFBundleDisplayName @@ -19,13 +17,15 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.1 + 1.0.2 CFBundleSignature ???? CFBundleVersion - 139 + 140 LSRequiresIPhoneOS + NSLocationAlwaysUsageDescription + NotifyMe needs to use background location updates for location changes to work correctly. NSMainNibFile~ipad Main UIBackgroundModes diff --git a/README.md b/README.md index 55680a9..3f81c22 100644 --- a/README.md +++ b/README.md @@ -142,17 +142,17 @@ Below shows the basics of how the CCHPush class is used to send and receive push // Register the app id of the application you created on https://app.contexthub.com [ContextHub registerWithAppId:@"YOUR-APP-ID-HERE"]; -// Register for remote notifications -#ifdef __IPHONE_8_0 - // iOS 8 and above - UIUserNotificationType notificationTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; - UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; - [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; -#else - // iOS 7 and below - UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; - [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; -#endif + // Register for remote notifications + if ([UIUserNotificationSettings class]) { + // iOS 8 and above + UIUserNotificationType notificationTypes = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; + UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; + [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; + } else { + // iOS 7 and below + UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; + [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; + } return YES; } diff --git a/release_notes.md b/release_notes.md index 319f092..a6a6512 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,7 +1,11 @@ Notify Me (Push) Sample App Release Notes --- -## v1.0.1 (Build 139) - September 17, 2014 +## v1.0.2 (Build 140) - September 16, 2014 +- Fix crashing bug when launching app on pre-iOS 8 device +- Update README + +## v1.0.1 (Build 139) - September 16, 2014 - Update to ContextHub v1.3.1 framework - Update compatibility for iOS 8 - Update README