Attempting to sent Push Notifications to iOS device - not receiving them

元气小坏坏 提交于 2019-12-11 08:47:56

问题


I have so far done the following: - Generated certificate and private key as .pem, also cat'd them together. Successfully connected to gateway.sandbox.push.apple.com. - Using the provisional profile with push notifications is enabled for development, I have a basic app that successfully prompted "Do you want to allow push notifications", so this is working correctly - Obtained the device token - I have tried pulling a few pre-made files for SSLing into sandbox from the internet just to see if I can get them running before I start development.

The files are the php file posted here: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12. I actually got a "Message successfully sent"

The python file posted here: Apple PNS (push notification services) sample code; I had to edit the Python 3 command "fromhash" line to str(float.fromhash(...))

I also tried using the PyAPNs API: https://github.com/simonwhitaker/PyAPNs. I still have use_sandbox set to true.

Obviously I changed the device tokens and public keys/certificates to my own. Sadly I have not received any pushed notifications yet, and I'm not receiving any concrete errors to tell me why. If anyone can shed some light, that would be amazing.


回答1:


From my comment in radesix's answer, and apologies that I can provide no more detail as it's been a year since I've touched iOS development.

The problem was my provisional profile had the "aps-environment" key set to developer, but for some reason xcode defaulted to "debug". Changing this in the editor solved my problem.




回答2:


Use a service like urban airship (urbanairship.com) and you'll have this up and running in minutes. Less for you to maintain in the long run also.



来源:https://stackoverflow.com/questions/11660451/attempting-to-sent-push-notifications-to-ios-device-not-receiving-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!