重新导致远程通知导致appDelegate iOS Parse.com

时间:2015-09-20 07:12:11

标签: ios objective-c parse-platform push-notification apple-push-notifications

我的应用程序由于此行[application registerForRemoteNotifications];而一直崩溃,我只能将它放在下面的位置才能工作。推送笔记不发送,因为我没有把它放在正确的位置。

if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];

        [application registerUserNotificationSettings:notificationSettings];
    } else {
        UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound;
        [application registerForRemoteNotificationTypes:notificationTypes];

        [application registerForRemoteNotifications];
    }

请帮我注册通知,以便设备让他们开启Parse它说推送已发送。任何想法?

请参阅崩溃消息

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't use nil for keys or values on PFObject. Use NSNull for values.'
*** First throw call stack:
(0x184474f5c 0x198f77f80 0x184474ea4 0x1000f0280 0x1000f4770 0x1001448bc 0x1000ac644 0x1002f1d70 0x1002f1d30 0x1002f7780 0x18442c258 0x18442a0c0 0x184358dc0 0x18f4ac088 0x189a32f60 0x1000ad2c4 0x1997a28b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)




NSNull for values."
0x1000f0278 <+128>: nop    
0x1000f027c <+132>: bl     0x100153e10               ; symbol stub for: objc_msgSend
0x1000f0280 <+136>: nop                            //thread 1:signal sigabrt
0x1000f0284 <+140>: ldr    x0, #766268               ; (void *)0x00000001a01f8798: NSString
0x1000f0288 <+144>: nop    
0x1000f028c <+148>: nop    
0x1000f0290 <+152>: ldr    x23, #752712              ; "class"
0x1000f0294 <+156>: mov    x1, x23
0x1000f0298 <+160>: bl     0x100153e10               ; symbol stub for: objc_msgSend
0x1000f029c <+164>: mov    x2, x0
0x1000f02a0 <+168>: nop    
0x1000f02a4 <+172>: nop    
0x1000f02a8 <+176>: ldr    x24, #752696              ; "isKindOfClass:"
0x1000f02ac <+180>: mov    x0, x20
0x1000f02b0 <+184>: mov    x1, x24
0x1000f02b4 <+188>: bl     0x100153e10               ; symbol stub for: objc_msgSend
0x1000f02b8 <+192>: tbnz   w0, #0, 0x1000f02e8       ; <+240> at PFObject.m:1918
0x1000f02bc <+196>: nop    
0x1000f02c0 <+200>: ldr    x0, #767680               ; (void *)0x00000001a01ee600: NSException
0x1000f02c4 <+204>: nop    
0x1000f02c8 <+208>: ldr    x8, #572792               ; (void *)0x000000019bde5500: 

我认为当我发表评论时,这一行是空的[currentInstallation setObject:[PFUser currentUser].objectId forKey:@"userId"];

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setObject:[[PFUser currentUser] objectId] forKey:@"userId"];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];

我该如何解决?

谢谢,

0 个答案:

没有答案