Skip to content

How do I troubleshoot issues with Push Notifications on iOS?

If you are having trouble with Push, the first place you should check is the Install in the web dashboard. It will show you if a device was properly registered for pushes and if/when a push was successfully sent:

1.Enable debug mode in your project.

[StreetHawk registerInstallForApp:<app_key> withDebugMode:YES];

2.In XCode console, you can find a lot of StreetHawk SDK logs with installid, for example:

2016-08-22 15:25:03.132 Dev[2373:1807648] POST -

4FXS62DDTOWC3IG5 is the install id.

3.Use the install id to search install in your App site, path Growth Campaigns->User Search:

4.Since XCode 8, it must explictly enable Push Notification in Capability tab. Otherwise, even setup provisioning profile and it contains "aps-environment", the App still fails to get push token due to error: missing aps-environment.

If your device can receive push notification, congratulations! If not, please send again and see whether there is error reporting. In case there is some error, please continue reading the common mistakes.

1.Your App ID is incorrect

Make sure the App ID you've uploaded your p12 file in the dashboard matches the one in you XCode project, and your XCode uses correct provisioning profile which uses the same App Id too.

2.You mix dev and prod

XCode has dev and prod provisioning profile, which matches to StreetHawk server's dev and prod certificates. Please make sure you don't mix them. Check here for more details.

3.Provisioning profile is out-of-date

Make sure your provisioning profiles are up-to-date. The device info is store in the provisioning profile so any time you add a new device to the profile you will need to re-create the profile. If the provisioning profile is revoked by someone else, you need to re-download it. Please make sure you sync provisioning profile in XCode and use latest one in your project.

4.Your .p12 is missing the certificate or the key

Make sure you expand certificate and select both of them when export.

5.Check XCode console log

With debug mode enabled ([StreetHawk registerInstallForApp:<app_key> withDebugMode:YES]; ) check XCode console log, and it may show warning such as:

WARNING: Register remote notification failed: Error Domain=NSCocoaErrorDomain Code=3000 "cannot find application's “aps-environment” string element." UserInfo={NSLocalizedDescription=cannot find application's aps-environment string element.}.

6.Enable Push Notification permission

In case you disallow push notification permission in system preferences, and you re-enabled it, please make your App to foreground so that server knows you re-enable permission. Otherwise if the App is kept in background, server will treat the install doesn't allow permission until App go to foreground.