1

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.

Community
  • 1
  • 1
limasxgoesto0
  • 4,555
  • 8
  • 31
  • 38

2 Answers2

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.

limasxgoesto0
  • 4,555
  • 8
  • 31
  • 38
-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.

radesix
  • 5,834
  • 5
  • 24
  • 39
  • So far, it hasn't let me create a new app, I keep getting an error page. Regardless, all I'm trying to do is send a simple message from a script and receive it, or at least find out a reason as to why they're not being received. – limasxgoesto0 Jul 26 '12 at 19:40
  • Basically, I've ruled out it being the code at this point. My device has prompted for push notifications, so my provisional profile checks out. My certificate/key have successfully connected to the sandbox server via openssl. So the only thing that could potentially be wrong is maybe I obtained the Device Token in the wrong way? I'm not sure how that would be possible. – limasxgoesto0 Jul 26 '12 at 20:14
  • Are you building out with a developer, ad hoc, or team profile? – radesix Jul 26 '12 at 23:56
  • Note that the device tokens are different dependening on developer vs distribution builds – radesix Jul 27 '12 at 02:30
  • How can I differentiate which I have then? – limasxgoesto0 Jul 27 '12 at 05:49
  • In the preprocessor settings I had DEBUG=1 set for the Debug mode, and printed a message out if DEBUG=1; the message printed, so I seem to be using the developer build. I assume that's the correct one to use? – limasxgoesto0 Jul 27 '12 at 17:46
  • Also ruled out firewalls - we don't block any outgoing connections – limasxgoesto0 Jul 27 '12 at 18:36
  • Got it working! 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. – limasxgoesto0 Jul 28 '12 at 05:06
  • @masahane, please post an in depth answer to the problem, not just a comment. Others, like myself, will find this SO post when they encounter this issue. Give back to the community you turn to when you are in need. – Bruno Bronosky Sep 19 '13 at 17:45
  • Crazy how you found this over a year later. Thanks for pointing it out. That said, having not done any iOS development since this, I won't be able to provide an iota of more detail than what was posted above. – limasxgoesto0 Sep 19 '13 at 21:21