As a @sadiqxs notification, there are two types of certificates, and in the comment you can find a great simplePush code ( http://d1xzuxjlafny7l.cloudfront.net/downloads/SimplePush.zip ).
BUT one often forgotten thing!
Your deviceToken changed (!!!) during compilation to production (ad-hoc) and deployment from Xcode. I suggest you do the following:
- Create a developer and production certificate in the developer center (what you already have)
- Download this simple push app.
- Read your device. Run the development program and see if it works.
NSLog token in the method: -(void)application:didRegisterForRemoteNotificationsWithDeviceToken:
:
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { NSString *dt = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]; dt = [dt stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"%@",dt"); }
- Check the device log and read the production marker
- Try with a simple tap if tapping on a device
6a) If yes, the problem is resolved
6b) If not, and you get push for dev env for sure , you have a problem with certificates and regenerate them
While you are using the SimplePush script, remember to change the url to production (gateway.push.apple.com) from the sandboxed program.
source share