想要提供PushNotifications时未显示设备令牌

时间:2014-08-06 14:22:12

标签: ios cordova apple-push-notifications

我遵循了这个教程:https://www.youtube.com/watch?v=_3YlqWWnI6s 在我的应用程序中提供PushNotifications。 顺便说一句:我的应用程序是基于Cordova的WebApp(也包括一个名为Flurry的AdService)。

一切正常,我构建了证书和配置文件,将其添加到Xcode,我启动了我的应用程序,它要求我允许PushNotifications。我说YES但它没有在控制台中显示DeviceToken。那我错了什么?它甚至不会调用didFinishedLaunchingWithOptions:方法

这是AppDelegate.m中的代码

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    CGRect screenBounds = [[UIScreen mainScreen] bounds];

#if __has_feature(objc_arc)
        self.window = [[UIWindow alloc] initWithFrame:screenBounds];
#else
        self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
#endif
    self.window.autoresizesSubviews = YES;

#if __has_feature(objc_arc)
        self.viewController = [[MainViewController alloc] init];
#else
        self.viewController = [[[MainViewController alloc] init] autorelease];
#endif

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


    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];


    //Start the Flyuury Session
    [Flurry startSession:@"#######################"];

    // Pointer to the rootViewController. Note: the initialize call should be
    // invoked only once immediately after the call to startSession
    [FlurryAds initialize:window.rootViewController];

    return YES;
}

以及注册时的方法:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"Hello");
    NSString *deviceTokenString = [NSString stringWithFormat:@"%@", deviceToken];
    NSLog(@"Dev Token: %@", deviceTokenString);

}

任何帮助都会很棒。

编辑: 这是控制台日志:

2014-08-06 16:33:03.004 UnserTeam[2066:60b] Multi-tasking -> Device: YES, App: YES
2014-08-06 16:33:03.062 UnserTeam[2066:60b] Unlimited access to network resources
2014-08-06 16:33:03.246 UnserTeam[2066:60b] [CDVTimer][file] 9.999990ms
2014-08-06 16:33:03.251 UnserTeam[2066:60b] [CDVTimer][TotalPluginStartup] 14.897048ms
2014-08-06 16:33:03.483 UnserTeam[2066:60b] Flurry: Starting session on Agent Version [Flurry_iOS_136_5.0.0] 
2014-08-06 16:33:03.660 UnserTeam[2066:60b] active
2014-08-06 16:33:04.834 UnserTeam[2066:60b] Resetting plugins due to page load.
2014-08-06 16:33:05.494 UnserTeam[2066:500f] 13 entries in the zip file
2014-08-06 16:33:07.904 UnserTeam[2066:60b] THREAD WARNING: ['Device'] took '13.353027' ms. Plugin should use a background thread.

最后一行是我认为最有趣的。

0 个答案:

没有答案