问题
I am developing mdm for iOS for testing purpose. I have installed the profile on the device and I have got the Device Token, PushMagic and now I want to send the mdm payload {"mdm":"PushMagicValue"}
and for this I am using the code
from APNSWrapper import *
wrapper = APNSNotificationWrapper('PushCert.pem', False)
message = APNSNotification()
message.token('CgeMZKRl2cqZAmGQ0VNCvySXAsaMPqeHga9ZUC3kqpM=')
message.appendProperty(APNSProperty('mdm', 'D60DAB80-A41D-4689-9F14-004E29431742'))
wrapper.append(message)
wrapper.notify()
print 'Done'
The problem is that my test server sends this message without any errors but I am not able to see any response on my device logs. Please tell me where I am wrong and how to make it work Any help will be appreciated...
回答1:
Apple now sends the Device Token in base64 encoded format for this we have to use the base64 function with the device token
instead of message.token('CgeMZKRl2cqZAmGQ0VNCvySXAsaMPqeHga9ZUC3kqpM=')
I used
message.tokenBase64("6CORK2VBuJCPi1Y8oB3PRyoIiSf7Aq5sD7noZ/Awxao=")
and this did the trick ....
来源:https://stackoverflow.com/questions/19356033/not-able-to-send-the-mdm-payload-and-command-to-device