2013-02-28 72 views
0

我已经创建了启用了推送通知的配置文件。在设备中安装IPA文件后,该应用程序不会获取设备令牌。有谁知道为什么这个问题出现在我的应用程序?IPA文件没有在iOS中获取设备标记

+0

究竟是你想做些什么?您需要在代码中添加一些内容才能获取设备令牌。 – DGund 2013-02-28 13:00:09

回答

0

在你的应用程序委托的didFinishLaunchingWithOptions中添加以下行

[[UIApplication sharedApplication] 

    registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert]; 

,然后实现委托功能 作为

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken 
    { 
     NSString *str = [[NSString stringWithFormat:@"%@",deviceToken] stringByReplacingOccurrencesOfString:@"<" withString:@""]; 
     str=[str stringByReplacingOccurrencesOfString:@">" withString:@""]; 
     str=[str stringByReplacingOccurrencesOfString:@" " withString:@""]; 

    //str is your device token and can used now. 
    }