Search code examples
iosapple-push-notificationsibm-cloudibm-mobilefirstibm-mobile-services

MobileFirst Starter - Bluemix Push Notification failure in Production mode


I am building an iOS app that can receive remote notification through Bluemix. I have the app Bundle Identifier in Xcode matches the AppId in Apple Portal which also match the APN certificate (xxx-sandbox.p12 and xxx-production.p12).

During development I have tested using Push Notification with Bluemix Sandbox (under MobileFirst Starter boilerplate). All work fine. I can receive notification in my iPhone. However when I tested in Production mode, I keep getting error messages: "Internal server error. No devices found".

I have confirmed that my device exists (using REST API: https://mobile.ng.bluemix.net/imfpushrestapidocs/#!/devices/get_apps_applicationId_devices).

Any suggestion is greatly appreciated.


Solution

  • Alright the REST API is showing that you have not registered any devices in production mode. Furthermore it is showing that the backend application is working in Sandbox mode, so let's change that first.

    To do so you'll want the PUT ApplicationID Settings REST API call:

    https://mobile.ng.bluemix.net/imfpushrestapidocs/#!/applications/put_apps_applicationId_settings

    With the json body

    { 
      "mode" : "PRODUCTION" 
    }
    

    I would then use the GET ApplicationID Settings REST API call to confirm that the mode switch has occurred (you should see "mode" : "PRODUCTION" in the response)

    https://mobile.ng.bluemix.net/imfpushrestapidocs/#!/applications/get_apps_applicationId_settings

    Once the environment mode has been switched you will need to re-run your client code to register your device in production mode. From there you should be able to push as you expect.