Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCM iOS Production not receiving notifications

So, I have a problem with GCM. I have uploaded .p12 development and production APNS certificates to Google Console (I've checked, they are the same name, bundle identifier). I have my development and production provision profile all set up. I have aps-environment in my production profile and I am able to upload normally to iTunes Connect. I am using:

    _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                    kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

for production. It is set to NO. For my development it is set to YES. I've checked, I am getting device token, and it is sent to my server.

Push notifications are just not working in Production environment. They only work in Development environment. Do you have any idea what's the cause?

like image 546
Flipper Avatar asked Nov 08 '22 22:11

Flipper


1 Answers

Set "priority": "high"

{
      "to": "gcm_device_token",
      "priority": "high",
      "content_available": false,
      "notification": {
        "sound": "default",
        "badge": "1",
        "title": "Push Title",
        "body": "Push Body"
      }
    }

Here's the code to use for production environment :

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                         kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

Here's the code to use for development environment :

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                         kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
like image 189
Ahmed Abdallah Avatar answered Nov 15 '22 05:11

Ahmed Abdallah