简体   繁体   English

解析推送通知:iOS设备令牌未定义

[英]Parse push notifications: iOS device token is undefined

I'm developing an app for iOS platform with Cordova (and Intel XDK). 我正在使用Cordova(和Intel XDK)为iOS平台开发应用程序。 I'm using this plugin for push notifications with Parse platform: https://github.com/cranberrygame/cordova-plugin-pushnotification-parse 我正在使用此插件通过Parse平台进行推送通知: https : //github.com/cranberrygame/cordova-plugin-pushnotification-parse

The device is registered to Parse properly, but the deviceToken is undefined, so when I send push notifications, nobody receives it. 设备已正确注册以解析,但是deviceToken未定义,因此当我发送推送通知时,没有人收到它。

在此处输入图片说明

I don't understand Objective-C very much but I know in this plugin's method, the device is sending the token to Parse, but it seems like it is never called: 我不太了解Objective-C,但我知道在此插件的方法中,设备会将令牌发送给Parse,但似乎从未调用过它:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken
{
        // Call existing method
        [self swizzled_application:application didRegisterForRemoteNotificationsWithDeviceToken:newDeviceToken];
        // Store the deviceToken in the current installation and save it to Parse.
        PFInstallation *currentInstallation = [PFInstallation currentInstallation];
        [currentInstallation setDeviceTokenFromData:deviceToken];
        [currentInstallation saveInBackground];
    }

Notifications are enabled in the iPhone for my app and I'm using iOS 8. 我的应用程序已在iPhone中启用了通知,而我正在使用iOS 8。

How can I do? 我能怎么做? Thanks in advance. 提前致谢。

I was also facing the same problem. 我也面临着同样的问题。

So the channel where you saw the sample code has been registered. 因此,您看到示例代码的通道已注册。 https://github.com/ParsePlatform/PushTutorial/blob/master/iOS/PushNotificationTutorial/AppDelegate.m#L39 https://github.com/ParsePlatform/PushTutorial/blob/master/iOS/PushNotificationTutorial/AppDelegate.m#L39

And the method was successful. 并且该方法是成功的。 I wonder if I channel is required to register ? 我想知道我是否需要注册频道吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM