我正在尝试使用生产 APN 服务器将 MDM 推送通知发送到 iPad。但是,Push Sharp 说通知失败是因为标识符等于 1。PushSharp 代码库中的以下代码说明了它是如何得出这个结论的......
//We now expect apple to close the connection on us anyway, so let's try and close things
// up here as well to get a head start
//Hopefully this way we have less messages written to the stream that we have to requeue
try { stream.Close(); stream.Dispose(); }
catch { }
//Get the enhanced format response
// byte 0 is always '1', byte 1 is the status, bytes 2,3,4,5 are the identifier of the notification
var identifier = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(readBuffer, 2));
int failedNotificationIndex = -1;
SentNotification failedNotification = null;
//Try and find the failed notification in our sent list
for (int i = 0; i < sentNotifications.Count; i++)
{
var n = sentNotifications[i];
if (n.Identifier.Equals(identifier))
{
failedNotificationIndex = i;
failedNotification = n;
break;
}
}
基本上,在将有效负载写入流之后,它会尝试关闭连接,在此期间它期望来自 APN 服务的响应,我认为它称为通知标识符。
我已将设备插入 iPhone 设备配置实用程序,但控制台中没有出现任何内容,因此我假设它从未收到此通知。
我的问题是...
- 它期望的这个标识符是什么?
- 有什么我做错了吗?
设备运行iOS 6。payload的结构如下...
{"aps":{},"mdm":"80369651-5802-40A2-A0AE-FCCF02F99589"}
返回的6个字节的byte[]中的值如下8,8,0,0,0,1