【问题标题】:App crashes on some devices应用程序在某些设备上崩溃
【发布时间】:2015-12-14 23:25:03
【问题描述】:

我的应用程序已启动,但在某些设备上崩溃了,但我也有混乱的日志,这令人困惑,他们建议它在此功能中崩溃。

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

- (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

【问题讨论】:

  • 是否有运行 iOS
  • 看起来它在告诉你readAction 是nil。
  • 是的,你认为这可能与 ios 版本有关?
  • readAction 它显然不是 nil,怎么可能只有少数设备而不是所有设备都是 nil?

标签: ios crash push-notification


【解决方案1】:

交互式通知适用于 IOS 8.0

【讨论】:

    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 2013-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多