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

前端 未结 5 727
梦毁少年i
梦毁少年i 2021-01-19 03:39

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

相关标签:
5条回答
  • 2021-01-19 03:50

    The site install IPA with ad-hoc distribution.

    For ad-hoc push notification, you need to use Apple's production push server, which is gateway.push.apple.com.

    I think you are using sandbox push server when you install it from Xcode.

    0 讨论(0)
  • 2021-01-19 03:58

    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.

    0 讨论(0)
  • 2021-01-19 04:03

    upload .p12 for production on parse to get notifications on ipa.

    0 讨论(0)
  • 2021-01-19 04:08

    Late to this question, but had a similar troubled experienced so thought I'd share. As @sadiqxs noted:

    • if you install from xcode - It uses development certificate

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

    This forms a big problem when you try to debug remote notifications. However, there is a simple workaround! The trick is to install an AdHoc build once, which will register the phone using the productions certificate. Then add the following block around your register method (the place in the code where you decided to register a user for notfications).

    #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 register statement when you run the app on consecutive builds through XCode and thus keep production notifications from coming in!

    Hope this helps

    0 讨论(0)
  • 2021-01-19 04:12

    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.

    0 讨论(0)
提交回复
热议问题