IPA文件未在iOS中获取设备令牌

IPA文件未在iOS中获取设备令牌,ios,xcode,devicetoken,Ios,Xcode,Devicetoken,我已启用推送通知创建配置文件。在设备中安装IPA文件后,应用程序不会获取设备令牌。有人知道我的应用程序中出现此问题的原因吗?在didFinishLaunchingWithOptions of your app delegate中添加以下行 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert]; 然后实现委托功能 作为 -(void)应用程

我已启用推送通知创建配置文件。在设备中安装IPA文件后,应用程序不会获取设备令牌。有人知道我的应用程序中出现此问题的原因吗?

在didFinishLaunchingWithOptions of your app delegate中添加以下行

[[UIApplication sharedApplication] 

   registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
然后实现委托功能 作为

-(void)应用程序:(UIApplication*)应用程序DIDregisterforRemotionTificationswithDeviceToken:(NSData*)deviceToken
{
NSString*str=[[NSString stringWithFormat:@“%@”,deviceToken]STRINGBYREPLACINGOURCRENCESOFSTRING:@“withString:@”];
str=[str STRINGBYREPLACINGOURCRENCESOFSTRING:@“with string:@]”;
//str是您的设备令牌,现在可以使用。
}

你到底想做什么?您需要在代码中添加一些内容来获取设备令牌。
  - (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.
   }