Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When install build from xcode push notification is working but when install ipa it is not working

I implemented push notification in my app and it is working when i install build from xcode but not working when i install app via a link generated by diawi.com why this is happening?

like image 555
Sachin Vani Avatar asked Sep 28 '22 19:09

Sachin Vani


2 Answers

Push apns certificates are different for Development & production

  • if you install from xcode - It uses development certificate

  • if install from diawi.com - It uses production certificate

on parse,com i think you have uploaded .p12 file generated from development certificate.

you have to upload .p12 file of production certificate & then check.

like image 145
Mohammad Sadiq Shaikh Avatar answered Oct 05 '22 06:10

Mohammad Sadiq Shaikh


As @sadiqxs notice there are two types of certs, and in a comment you can find excelent simplePush code (http://d1xzuxjlafny7l.cloudfront.net/downloads/SimplePush.zip).

BUT one often forgotten thing!

Your deviceToken changed (!!!) while you compile to production (ad-hoc) and deploy from Xcode. What i suggest you to do is:

  1. Create both developer and production certificate in developer center (what you already have)
  2. Download this simple push app
  3. Read your deviceToken for development env and check if it's working
  4. NSLog the token in method: -(void)application:didRegisterForRemoteNotificationsWithDeviceToken:

sample:

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
    NSString *dt = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    dt = [dt stringByReplacingOccurrencesOfString:@" " withString:@""];
    NSLog(@"%@",dt");
}
  1. Check out the device log and read the production token
  2. Try with simple push if push got to device

6a) If yes, problem solved

6b) If no, and you receive the push for dev env for sure you have an issue with certificates and regenerate them

While you using SimplePush script remember to change url to production (gateway.push.apple.com) from sandbox one.

like image 33
Jakub Avatar answered Oct 05 '22 07:10

Jakub