didRegisterForRemoteNotificationsWithDeviceToken:不调用调用registerForRemoteNotificationTypes:? [英] didRegisterForRemoteNotificationsWithDeviceToken: doesn't invoke on calling registerForRemoteNotificationTypes:?

查看:2608
本文介绍了didRegisterForRemoteNotificationsWithDeviceToken:不调用调用registerForRemoteNotificationTypes:?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个navBased应用程序推送通知的工作。在AppDelegate.m didRegisterForRemoteNotificationsWithDeviceToken:不调用上调用registerForRemoteNotificationTypes:code是这样的:

I am working with push notifications in a navBased app. in AppDelegate.m didRegisterForRemoteNotificationsWithDeviceToken: doesn't invoke on calling registerForRemoteNotificationTypes: code looks like this:

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

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

    [self.window addSubview:navigationController.view];
    [self.window makeKeyAndVisible];

    return YES;
}



- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Get a hex string from the device token with no spaces or < >
    NSLog(@"applicationDidFinishLaunchingWithOptions dev token test");

    NSString *deviceTokenStr = [[[[deviceToken description]
                          stringByReplacingOccurrencesOfString: @"<" withString: @""] 
                         stringByReplacingOccurrencesOfString: @">" withString: @""] 
                        stringByReplacingOccurrencesOfString: @" " withString: @""];

    NSLog(@"Device Token: %@", deviceTokenStr);
}

我敢肯定,调配配置文件是没有问题的。我发现错误:

I am quite sure that provisioning profile is not the problem. and i found error:

错误登记。错误:错误域= NSCocoaErrorDomain code = 3000没有有效的APS-环境的权利字符串中找到应用程序的UserInfo = 0x115490 {NSLocalizedDescription =没有有效的APS-环境的权利找到了应用字符串}

Error in registration. Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x115490 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

谁能告诉我什么是这个code回事和y它不工作?感谢名单

can anyone tell me whats going on in this code and y its not working? thanx

推荐答案

检查:<一href=\"http://docs.urbanairship.com/reference/troubleshooting/ios-push.html#networks-may-restrict-access-to-tcp-5223\"相对=nofollow>链接
并确保您有5223端口打开。

Check this: link And make sure that you have 5223 port opened.

这篇关于didRegisterForRemoteNotificationsWithDeviceToken:不调用调用registerForRemoteNotificationTypes:?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆