Troubleshooting

When you are stuck with the APNs-based push notification implementation, See the following items:

  1. Are you using a real device?

    APNs does not work on an emulator. Also, make sure that your device is online.

  2. Are you using the correct access keys?

    The sender and receiver must be the same Kii application, meaning that they have to use the same AppID.

  3. Does your Apple App ID include a wildcard?

    If you signed your app manually, verify that the App ID registered to the Apple Developer website does not contain any wildcard.

    You cannot use a wildcard in the App ID of your mobile app if it is to receive push notifications.

  4. Is a valid password set on the SSL certificate for the push notification?

    The P12 certificate for the push notification needs to be set properly on the Kii Cloud developer portal. Note that the developer portal does not give you an error when the password does not match when you export the certificate.

  5. Are the certificates properly set?

    Be careful not to mix these certificates. The application certificate is used for signing the executable upon building it while the SSL certificate is used for securing the channel for the push notification.

    If you set the application certificate on the developer portal's "PUSH NOTIFICATIONS" configuration, the push feature, of course, will not work properly (note that you will not get any error).

  6. Are you setting the development/production correctly?

    You need to select the correct environment. Make sure that you are selecting the correct environment that matches with the followings:

    • The SSL certificate obtained in the Apple Developer website
    • The application certificate obtained in the Apple Developer website
    • The provisioning profile obtained in the Apple Developer website
    • The SSL certificate and its password set on the Kii Cloud developer portal
    • The provisioning profile selected on Xcode
    • The Build Configuration of Xcode (Debug or Release)
    • The environment you select when initializing the Kii Cloud push notification feature (some APIs will apply the production environment as default).
    • The target environment selected when sending a push message (e.g. sending from the developer portal or sending via API).
  7. Did the mobile app execute the initialization code properly?

    Did you implement the initialization code described in the tutorial? Did the code throw any execution error? Check with the debugger and review the log.

    Specifically, confirm that the prompt message is displayed for user permission when the initialization API is called and that the didRegisterForRemoteNotificationsWithDevieToken method passes a string that looks like a device token.

    If the code does not work, the build process might not have completed properly. Review the settings for code signing in Xcode.

  8. Is push notification enabled in Xcode?

    Confirm that both push notification and silent notification are enabled in the "Capabilities" page of Xcode. If those options are not displayed, check if the developer account used in Xcode is correct.

    See Configure the Project in Xcode to learn how to configure those options.

  9. Is the provisioning profile the latest one?

    You might find multiple provisioning profiles registered on your PC (this sometimes occur when you update and register the profiles multiple times). Xcode might present these profiles with the same name, which makes it hard to determine which one is the latest.

    We advise you to delete old provisioning profiles by deleting the files under ~/Library/MobileDevice/Provisioning Profiles/. You can open the Finder from the list of the provisioning profile in the Preference. Probably the easiest way is to delete all files in this directory before you register a new profile.

  10. Are the certificate and provisioning profile enabled?

    Check the certificate and provisioning profile on the Apple Developer website to see if they are valid and not disabled.

    It is likely that the certificate has been expired if the push notification feature suddenly stops working in the production phase.

  11. Are you using the correct bucket/topic scope?

    Make sure that the scope you've subscribed and the scope that triggered the push messages match.

    • If you are using the Push to App messages, double check if the bucket scope matches.
    • If you are using the Push to User messages, double check if the topic scope matches.

    For example, the following iOS Push to App sample does not work properly because the subscription is made in the application scope while the updating is made in the user scope.

    • Subscribing: [Kii bucketWithName:@"myBucket"];
    • Updating: [user bucketWithName:@"myBucket"];
  12. Did you set a message body when you send a push notification from the developer portal?

    When you send a push notification from the developer portal, setting a string as the message body in the body key under the alert key might help successful delivery of the notification.

    iOS could ignore push notifications that do not trigger any actions to the user interface nor a reception handler. Set at least one of keys such as body, sound, badge, and content-available in the payload so that your notification is received.

    For more information, see Combinations of Reception Methods.

  13. Did you check the developer log?

    You might find some push-related information in the developer log.

    When an error occurs on a Kii Cloud API, the failure reason is sometimes recorded in the developer log. By inspecting the developer log, you might find some hints to resolve the issue.

    Here is an example of the message recorded in the developer log when the FCM payload exceeds 4096 bytes.

    2015-01-21T14:51:16.159+09:00 [ERROR] push.send description:Failed to send Push Message sender: origin:EXPLICIT messageID: type: succeeded-endpoints: failed-endpoints: exception:There are validation errors: payload - The size of the payload exceeds the maximum allowed for GCM messages: 4096 bytes.
    
  14. Isn't the notification method executed directly?

    If you are using iOS, the push notification method could be directly executed without showing any message on Notification Center. This depends on the mobile app status and the tag defined in the push message.

    You might not notice that your application got a push message if you are expecting to see it shown in Notification Center. Insert a logic to record a log message in the notification interface method in such a situation.

    Also, make sure that the push message you want to show is included in the alert key (Note that you cannot do this customization on the Push to App notification).

    For more details on the behavior of iOS devices when they receive push notifications, see Combinations of Reception Methods.

  15. Wait a while...

    Unfortunately, push notifications sometimes take some time to be delivered.