应用程序在某些设备上崩溃

时间:2015-01-14 13:42:52

标签: ios crash push-notification

我的应用程序已启动,并且在某些设备上崩溃并非所有我都有乱七八糟的日志,这些令人困惑,他们建议它在此功能中崩溃。

应用程序启动时会调用此函数(它会立即崩溃) 任何帮助将不胜感激

- (void) setupForPushNotifications {
UIMutableUserNotificationAction *readAction = [[UIMutableUserNotificationAction alloc] init];
readAction.identifier = @"READ_IDENTIFIER";
readAction.title = @"Read";
readAction.activationMode = UIUserNotificationActivationModeForeground;
readAction.destructive = NO;
readAction.authenticationRequired = YES;

UIMutableUserNotificationAction *ignoreAction = [[UIMutableUserNotificationAction alloc] init];
ignoreAction.identifier = @"IGNORE_IDENTIFIER";
ignoreAction.title = @"Ignore";
ignoreAction.activationMode = UIUserNotificationActivationModeBackground;
ignoreAction.destructive = NO;
ignoreAction.authenticationRequired = NO;

UIMutableUserNotificationAction *deleteAction = [[UIMutableUserNotificationAction alloc] init];
deleteAction.identifier = @"DELETE_IDENTIFIER";
deleteAction.title = @"Delete";
deleteAction.activationMode = UIUserNotificationActivationModeForeground;
deleteAction.destructive = YES;
deleteAction.authenticationRequired = YES;

UIMutableUserNotificationCategory *messageCategory = [[UIMutableUserNotificationCategory alloc] init];
messageCategory.identifier = @"MESSAGE_CATEGORY";
[messageCategory setActions:@[readAction, ignoreAction, deleteAction] forContext:UIUserNotificationActionContextDefault];
[messageCategory setActions:@[readAction, deleteAction] forContext:UIUserNotificationActionContextMinimal];

NSSet *categories = [NSSet setWithObject:messageCategory];

UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:categories];

[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];

}

===========================================

这是崩溃日志的一部分

    Exception Type:  SIGABRT
Exception Codes: #0 at 0x396631f0
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

Application Specific Backtrace 1:
0   CoreFoundation                      0x2e91bf0b <redacted> + 130
1   libobjc.A.dylib                     0x390aece7 _objc_exception_throw + 38
2   CoreFoundation                      0x2e8552eb -[__NSPlaceholderArray initWithObjects:count:] + 418
3   CoreFoundation                      0x2e85ec61 +[NSArray arrayWithObjects:count:] + 44
4   RunnerXiOS                          0x000b6a83 -[AppController setupForPushNotifications] + 482
5   RunnerXiOS                          0x000b5a57 -[AppController application:didFinishLaunchingWithOptions:] + 1222
6   UIKit                               0x311bacc1 <redacted> + 276
7   UIKit                               0x311ba613 <redacted> + 1610
8   UIKit                               0x311b4cc9 <redacted> + 720
9   UIKit                               0x31150c97 <redacted> + 3550
10  UIKit                               0x3114fdf9 <redacted> + 72
11  UIKit                               0x311b4405 <redacted> + 616
12  GraphicsServices                    0x337adb55 <redacted> + 608
13  GraphicsServices                    0x337ad73f <redacted> + 34
14  CoreFoundation                      0x2e8e6847 <redacted> + 34
15  CoreFoundation                      0x2e8e67e3 <redacted> + 346
16  CoreFoundation                      0x2e8e4faf <redacted> + 1406
17  CoreFoundation                      0x2e84f769 _CFRunLoopRunSpecific + 524
18  CoreFoundation                      0x2e84f54b _CFRunLoopRunInMode + 106
19  UIKit                               0x311b362b <redacted> + 762
20  UIKit                               0x311ae891 _UIApplicationMain + 1136
21  RunnerXiOS                          0x000cf627 -[CCAtlasNode setQuadsToDraw:] + 90
22  RunnerXiOS                          0x00072218 __mh_execute_header + 21016

1 个答案:

答案 0 :(得分:1)

交互式通知适用于IOS 8.0