When installing an assembly from xcode, the push notification works, but when installing ipa, it does not work

I implemented a push notification in my application, and it works when I install the assembly from xcode, but it doesn’t work when I install the application through the link created by diawi.com, why is this happening?

+5
source share
5 answers

Push apns certificates differ for development and production

  • if you install from xcode - it uses a development certificate

  • if installed with diawi.com - it uses a manufacturing certificate

on parse, com, I think you downloaded the .p12 file generated from the development certificate.

you need to download the production certificate .p12 file and then verify.

+3
source

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"); } 
  1. Check the device log and read the production marker
  2. 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.

+1
source

The site establishes an IPA with ad-hoc distribution.

For one-way push notification, you need to use the Apple push server, which is gateway.push.apple.com .

I think you are using the pushbox server when you install it from Xcode.

0
source

upload .p12 for parsing to get notifications on ipa.

0
source

Late to this question, but I had the same vague experience as I thought. As @sadiqxs noted:

β€’ if you install from xcode - it uses a development certificate

β€’ if installed from diawi.com - it uses a manufacturing certificate

This creates a big problem when trying to debug remote notifications. However, there is an easy workaround. The trick is to install the AdHoc assembly once, which will register the phone using a production certificate. Then add the following block around your registration method (the place in the code where you decided to register the user for notifications).

 #ifndef DEBUG //your code to register for notifications, something along the lines of UIApplication* application = [UIApplication sharedApplication]; [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; #endif 

What this will do is skip the case expression when you run the application in sequential builds via Xcode and thus continue to receive production notifications!

Hope this helps

0
source

Source: https://habr.com/ru/post/1212791/


All Articles