苹果MDM - 推送通知话题 [英] Apple MDM - Push notification topic

查看:632
本文介绍了苹果MDM - 推送通知话题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设立一个MDM服务器,我已经通过了所有的证书生成步骤。我可以我的MDM服务器上成功注册。但是,当我发送唤醒推送通知我没有得到任何响应返回从设备。

I'm setting up a MDM server and I've passed all the certificates generation steps. I can enrol successfully on my mdm server. But when I send the wakeup push notification I get no response back from the device.

我使用的是的Java APNS 库发送MDM推送通知。这里的code:

I'm using the Java APNS library to send the mdm push notification. Here's the code:

final String token = getToken("dlfkjgldfjglfl"); 
ApnsService service = APNS.newService()
                .withDelegate(listener)
                .withCert(P12_FILE_PATH, "password")
                .withProductionDestination()
                .build(); 
final String payloadString = APNS.newPayload().mdm("push_magic_token").build(); 

// Send the wake up push notification to APNS
service.push(token, payloadString);

我得到了code以上和委托打印没有错误或异常环境:生产|推送通知发送|通知:消息(ID = 1;令牌= the_token;有效载荷= {MDM:magictoken})这意味着推被送到APNS成功,但该设备永远不会醒来和我的MDM服务器进行通信

I get no errors or exceptions with the code above and the delegate prints environment:production|push notification sent|notification:Message(Id=1; Token=the_token; Payload={"mdm":"magictoken"}) Which means the push was sent to APNS with success but the device never wakes up and communicates with my mdm server.

苹果文档上进一步阅读之后,它指出,有指定的推送通知的话题的需要,但库没有方法来设置的话题。

After further reading on the Apple documentation it states that there is the need to specify a topic for the push notification but the library has no method to set the topic.

从<一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW1\"相对=nofollow>苹果文档:

APNS-话题:远程通知,这通常是为您的应用程序捆绑ID的话题。你创建的证书
  会员中心必须包括这个话题的能力。如果你的
  证书包括多个主题,您必须指定一个值
  这个头。如果省略此头和您的APN证书呢
  未指定多个主题,在服务器的APN使用证书的
  主题为默认的主题。

apns-topic: The topic of the remote notification, which is typically the bundle ID for your app. The certificate you create in Member Center must include the capability for this topic. If your certificate includes multiple topics, you must specify a value for this header. If you omit this header and your APNs certificate does not specify multiple topics, the APNs server uses the certificate’s Subject as the default topic.

从Java APNS库正在使用的话题,因为证书主体这个我presume。

From this I presume the Java APNS library is using the topic as the certificate subject.

要生成证书,我也跟着本教程厂商。 P12 文件中生成不被APNS接受我的推送通知证书(握手错误)。一些谷歌上搜索我想通了之后有些人也有这个问题,他们固定它产生另一个的.p12 mdm.cer 从苹果下载使用产生的MDM证书:

To generate the certificates I followed this tutorial but the vendor.p12 file generated wasn't being accepted by APNS as my push notification certificate (handshake error). After some googling I figured out some people also had this problem and they fixed it generating another .p12 from the mdm.cer downloaded from Apple generated MDM Certificate using:

openssl x509 -in mdm.cer -inform DER -out push_developer.pem -outform PEM
openssl pkcs12 -nocerts -in vendor.p12 -out vendor.pem
openssl pkcs12 -export -inkey vendor.pem -in push_developer.pem -out push_developer.p12

我是用我的推送通知的证书则 push_developer.p12

我不熟练证书的管理,所以我失去了。
我的问题是如何设置的话题证书?

I'm not skilled with certificates management so I am lost. My question is how can I set the topic in the certificate?

推荐答案

我设法弄清楚如何的话题作品。这的确是在证书中。

I managed to figure out how the topic works. It is indeed within the certificate.

由于我在Mac上我将解释如何获得在Mac上适当的证书。

As I'm on a mac I'll explain how to get the proper certificate on a mac.


  1. 下载由苹果公司所产生的MDM证书(你应该可以从你的MDM控制面板下载苹果网站上)

  2. 在你的机器上安装该证书

  3. 开启钥匙扣,找到您刚才安装的步骤2中的证书应该是这样的:APSP:slkjl34435-sdkj-sfd0-34o5uoijsdf

  4. 单击箭头,你应该看到的私钥。

  5. 选择证书。右键单击并选择导出1项。 仅导出证书,并在证书+私钥。

  6. 保存.p12文件,并使用它作为您的MDM推送通知证书。

通过这些步骤,我设法拿到题目的工作,但我的设备仍然没有醒来。我将打开有关设备不能醒来,因为这是更相关的话题和证书的新问题(我认为该设备没有醒来,因为主题是不正确的)。

With these steps I managed to get the topic to work but my device is still not waking up. I'll open a new question regarding the device not waking up as this was more related to the topic and the certificate (I thought the device didn't wake up because the topic was incorrect).

这篇关于苹果MDM - 推送通知话题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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