[__ NSPlaceholderArray initWithObjects:count:]:尝试从对象[0]'中插入nil对象。使用解析

时间:2015-08-12 10:21:28

标签: ios objective-c parse-platform

我正在尝试实现解析推送通知。但是我在主要说法*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

中收到错误

在app委托的viewdidload中,我有什么问题吗?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [Parse enableLocalDatastore];
    // Enable Crash Reporting
    [ParseCrashReporting enable];


    // Initialize Parse.
    [Parse setApplicationId:@""
                  clientKey:@""];


    RVConfig *config = [RVConfig defaultConfig];
    config.applicationToken = @"<>";
    [config addBeaconUUID:@"<"];

    Rover *rover = [Rover setup:config];
    [rover startMonitoring];

    UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                    UIUserNotificationTypeBadge |
                                                    UIUserNotificationTypeSound);
    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
                                                                             categories:nil];
    [application registerUserNotificationSettings:settings];
    [application registerForRemoteNotifications];

    [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound];

return YES;
}

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];
}


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    currentInstallation.channels = @[ @"global" ];
    [currentInstallation saveInBackground];
}




- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    if ([[Rover shared] handleDidReceiveLocalNotification:notification]) {
        return;
    }
}

我可能遗漏了一些东西,这是我第一次在objective-c中使用parse实现push。任何帮助表示赞赏。谢谢

0 个答案:

没有答案