registerForRemoteNotificationTypes不仅适用于安装了iOS7的iPhone

时间:2014-04-04 12:44:58

标签: ios iphone objective-c ios7 push-notification

我的生产/开发证书和provisionProfiles的每件事情都可以。以下代码成功被称为application:didRegisterForRemoteNotificationsWithDeviceToken:,其中安装了iOS6系统设备

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

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

    // my implementations

    return YES;
}

但是当我使用iOS7安装的设备进行调试时,didRegisterForRemoteNotificationsWithDeviceTokendidFailToRegisterForRemoteNotificationsWithError都没有被调用。我使用Ad-hoc发行版为测试人员分发了应用程序,并为iOS7设备分配了同样的问题。

可能与我的问题有什么关系?

P.S。我的XCode版本:5.1(5B130a)

2 个答案:

答案 0 :(得分:0)

它为我工作 希望能帮到你

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

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

return YES;
}   







 -(void)application:(UIApplication *)application   didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSLog(@"%@",deviceToken);

}

答案 1 :(得分:0)

检查您的Ad-Hoc配置文件并确保已启用推送通知