在iOS中没有获得phonegap推送插件中的令牌

时间:2014-01-09 09:53:17

标签: ios cordova

我正在使用推送插件开发一个phonegap应用程序。我没有得到令牌ID。 当我登录时,我收到以下消息

请帮忙

ERROR: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-01-09 15:14:21.315 PushNotification[2296:907] -[CDVCommandQueue executePending] [Line 103] 
FAILED pluginJSON = [
  "PushPlugin463402949",
  "PushPlugin",
  "register",
  [
    {
      "alert" : "true",
      "ecb" : "onNotificationAPN",
      "sound" : "true",
      "badge" : "true"
    }
  ]
]

1 个答案:

答案 0 :(得分:0)

打开AppDelegate.m并粘贴此代码

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

进入

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{

}

然后在@end

之前通过此代码
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSLog(@"My token is: %@", deviceToken);
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
}