简体   繁体   English

带有Apple Entapprise应用程序的Apple Push通知未获得设备令牌

[英]Apple push notification with Apple entreprise app don't get the device token

I set up everything (creates certificates) and figured out to get the device token in development environment. 我设置了所有内容(创建证书),并弄清楚了要在开发环境中获取设备令牌。

When I call: 当我打电话时:

[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

I get the device token here: 我在这里获取设备令牌:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{ ...

But with apple entreprise, when I export the app and download it on an iPhone, the application:didRegisterForRemoteNotificationsWithDeviceToken is never called! 但是,有了苹果公司,当我导出应用程序并将其下载到iPhone上时,永远不会调用以下应用程序:didRegisterForRemoteNotificationsWithDeviceToken

I've created : 我已经创建了:

  • an IOS Distribution certificate (with the right App ID) IOS分发证书(具有正确的应用程序ID)

  • an APNS Production certificate (with the right App ID) APNS生产证书(具有正确的应用程序ID)

  • a provisioning profile allowing APN (with the right App ID) 允许APN(具有正确的App ID)的配置文件

I have the same for the development , and as I said, when I launch the app from xcode, I get the device token. 对于开发,我也是如此,正如我所说,当我从xcode启动应用程序时,我得到了设备令牌。 Why not in the exported app?! 为什么不在导出的应用程序中?

I had face the similar issue before, Mine was an issue with provision file issue, Xcode wrongly pick XC Ad Hoc provisioning or some times Wildcard app provision while generating build see the image below 我之前也遇到过类似的问题,我的问题是配置文件问题,Xcode在生成构建时错误地选择了XC Ad Hoc设置 ,有时选择了Wildcard应用程序设置,请参见下图 在此处输入图片说明 .

With Wildcard app provision push notification will not work. 使用通配符应用程序设置时,推送通知将不起作用。 From Xcode 6 has this problem and there is no option to select the right provision from here. Xcode 6中存在此问题,没有选项可以从此处选择正确的条款。 But i found another solution for this. 但是我为此找到了另一种解决方案。 Right click the archive from Organizer and select show in finder -> 右键单击管理器中的存档,然后选择在查找器中显示->

Right click the archive file and select show package content -> 右键单击存档文件,然后选择显示包内容->

choose product -> Applications . 选择产品->应用程序。

Here you can see a file with your app name. 在这里,您可以看到带有您的应用名称的文件。 copy it to a folder somewhere name the folder Payload , then compress it, so you have Payload.zip. 将其复制到一个名为Payload的文件夹中,然后对其进行压缩,从而得到Payload.zip。

Then rename it to Payload.ipa. 然后将其重命名为Payload.ipa。 hope it will help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM