Commit c02c926a by Sebastián Katzer

Fix iOS7 crash (#280)

parent fa87fdc5
......@@ -20,6 +20,7 @@
*/
#import "APPLocalNotification.h"
#import <Cordova/CDVAvailability.h>
@interface APPLocalNotification (Private)
......@@ -238,11 +239,13 @@
*/
- (void) promptForPermission:(CDVInvokedUrlCommand *)command
{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
UIUserNotificationType types =
UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
if (IsAtLeastiOSVersion(@"8.0")) {
UIUserNotificationType types;
UIUserNotificationSettings *settings;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil];
[self.commandDelegate runInBackground:^{
......@@ -257,14 +260,16 @@
*/
- (BOOL) hasPermissionToSheduleNotifications
{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
UIUserNotificationSettings *settings = [[UIApplication sharedApplication]
if (IsAtLeastiOSVersion(@"8.0")) {
UIUserNotificationType types;
UIUserNotificationSettings *settings;
settings = [[UIApplication sharedApplication]
currentUserNotificationSettings];
UIUserNotificationType requiredTypes =
UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
return (settings.types & requiredTypes);
return (settings.types & types);
} else {
return YES;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment