Native iOS Troubleshooting

Troubleshooting common issues with our Native iOS SDK

📘

Troubleshooting Steps

Check the below first for common issues with Native Android Setup.

Try our example project on GitHub.

If stuck, contact support directly by sending an email to [email protected].

For faster assistance, please provide the following:

  • Your iZooto App ID (available under Settings > General > Account ID for the iOS property on the panel)
  • Details, logs, and screenshots of the issue
  • Steps to reproduce

Ensure you follow all the steps mentioned below. If you are still having issues, please reach out to our support team with a log generated following the steps below.

Step 1: Double Check Setup Guide

Return to the setup guide available at iOS Native SDK Setup to make sure you followed all steps adding the iZooto SDK to your app.

Keep an eye on the Prerequisites section of the setup guide that you are using the right version of XCode. You must test on an actual iOS device. The Simulator does not support push.

If using Cocoapods: Make sure you have version 1.11.0 or newer of Cocoapods by running pod --version from the terminal.

Step 2: Use the latest iZooto SDK

Make sure you are running version 2.0.2 or newer of the iZooto SDK.

Run pod update iZooto from the terminal to update to the latest version of the iZooto SDK.

Step 3: Check below for common issues and it still not sure send us a log.

After going through the rest of this troubleshooting document, share the full logcat from the device when reproducing the behaviour with our support team. Our support team will assist you further.


APNS Delegate Never Fired

"APNS Delegate Never Fired" is a timeout message for when iOS does not fire a success or a failure message if a connection is not made to Apple's APNS Servers. This usually occurs in Development / Ad-hoc environments and is rarer in Production.

Please check the following:

1. Toggle WiFi on iOS Device

Try toggling WiFi on the iOS testing device, try a different device or a different network. You may see this more often with development builds of your app since this will be connecting to Apple's Sandbox server instead of Production.

2. XCode Capabilities

Make sure you are using XCode 10 or higher and you have the Push Notifications Capability in the Main App Target > "Signing & Capabilities" > Push Notifications. Some users reported enabling Background Fetch in Main App Target helped reduce the frequency as well. Check that this is enabled for both Debug and Release builds. You may need to check your entitlements if these are different.

3. Other Push Dependencies

Other Dependencies, especially other Push Provider SDKs, can interfere with this. It is best to remove the other Push SDK from the app. We swizzle the AppDelegate methods and other 3rd party SDKs could be impacted.

You may or may not see in the logs: WARNING: Already swizzled UIApplication.setDelegate. Make sure the iZooto library was not loaded into the runtime twice!

Common Dependency Issues:

  • React Native Push Notifications appears to add methods within the native AppDelegate file. Search the project in XCode for RNCPushNotificationIOS and comment out that code.
  • mParticle needs to have it to work with swizzlling instead of delegate proxy.

4. Cocoapods

If using Cocoapods, run $ sudo gem install cocoapods again to get updated, then pod update to update your pods. Make sure to remove any pods that you do not use anymore (especially other push SDKs).

5. Logs

After the above steps, if you are still facing any issues, it is best to plug your device into the IDE. Then uninstall and re-build the app on the device. Then share the crash logs with our support team for further assistance.


Clicks Not Counting

Make sure your app is initializing iZooto from didFinishLaunchingWithOptions and from the main thread. Otherwise, it can miss the click event if the app is cold started from a click.

If you have any other SDKs or libraries handling push notifications, then it is possible it is an issue with swizzling the iOS click handler and conflicting with iZooto.


URL Not Working

ERROR: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

Make sure your URL is HTTPS. HTTP URLs won't work unless you set NSAppTransportSecurity to NSAllowsArbitraryLoads in your XCode .plist.

❗️

About App Transport Security

Please do not leave NSAllowsArbitraryLoads enabled when releasing your app to the AppStore, as this can create a security vulnerability in your app. For more information, please read Apple's Security Overview.


Notification is shown but Media Attachments are not Displayed

1. Open your attachment URL in a web browser. Make sure it is a direct link to the image, it cannot be a part of an HTML page. Also, redirects are not supported.

2. Make sure the URL is HTTPS. HTTP URLs won't work unless you set NSAppTransportSecurity to NSAllowsArbitraryLoads in your XCode .plist.

3. Make sure your URL ends with the correct file extension. If the URL does not contain a file extension you can add it as a parameter by adding ?filetype=file.jpg, for example, to the end of your URL.

4. Please double check you have correctly added the NotificationServiceExtension noted in Step 2 of the iOS Setup Guide.

5. If you correctly added the iZooto NotificationServiceExtension and rich push notifications (images, buttons) still do not appear, make sure that the Deployment Target in the Extension Service matches the deployment target of your application.

Notification is shown but action buttons are not displayed

Please double check you have correctly added the NotificationServiceExtension noted in Step 2 of the iOS Setup Guide.


Debug the NotificationServiceExtension

1. Double check that you followed all setup instructions first.

2. The 2 debugging lines in the source file we provide are 2 ways to confirm the notification service extension is running.

self.bestAttemptContent.body = [@"[Modified "stringByAppendingString:self.bestAttemptContent.body];

This line will add "[Modified]" to the beginning of all your notification bodies. You should see this on all notifications on your device.

NSLog(@"Running NotificationServiceExtension");

This will add an entry to the device log when the extension is run. You can view this in XCode under Window > "Devices and Simulators". Select your device on the left and open the log up arrow at the bottom.

We recommend clearing the log before sending a notification to test as it can grow quickly. Copt the log and search for the debug entry Running NotificationServiceExtension.

We do not recommend trying to attach to the extension process with the debugger in XCode through the Debug menu. Doing so can create issues with its launch. We recommend restarting your device if you have tried doing so.

Lastly, the Notification Service Extension will only run if you have set our Action Buttons, a Media Attachment, or have set mutable content on the notification. So, ensure your test notification has one of these set.


Swift: No such module 'iZooto'

CocoaPods: Pods written in Swift should be imported with use_frameworks! and CocoaPods will complain if you do not do this and try to import the pods in Swift code.

Manual Import: One way to solve your issue is to go to your build settings and define the Framework Search Paths to a folder that contains the frameworks in question. If the iZooto framework is placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.

SwiftLint Issue: SwiftLint is a tool used to check if your code meets certain guidelines. If SwiftLint was running before the iZooto framework is embedded, it will cause this error to show up and then be resolved once everything is linked.


How to Get a Crash Log from an iOS Device

NOTE: For your crash to show in the following steps, the crash must happen when your device is not connected to your Mac. Connect it after you reproduce the crash.

1. In XCode, go to Window > Devices & Simulators.
2. Select your device on the left and press the "Open Console" button.
3. Select "All Messages" (top left).
4. Reproduce issue with the connected device.
5. Press Command + A to select all, then Command + C to copy log.
6. Send it to iZooto support along with details on reproducing the crash.


Previous Push Notifications Disappear

The iZooto SDK will automatically clear previously received push notifications when the app is opened under two conditions:

  • The badge number is set to 0 or greater than 0.
  • The application was opened from a push notification.

This behaviour is caused by our system to clear the badge number. Most app developers want this behaviour; however, some do not.


App Groups Error

Couldn't read values in CFPrefsPlistSource<0x281514780> (Domain: group.com.izooto.example.izooto, 
User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), 
Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for
System Containers, detaching from cfprefsd

This error is normal and results from a bug in iOS. It should appear if you have App Groups added correctly. For more info, read this comment by an Apple employee.

Can we setup multiple Notification Service Extensions for Multiple Targets in single XCode Project?

For example, we are using multiple targets within the same XCode Project. 2 separate apps to be uploaded to the AppStore. Getting error "Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier" and cannot enable separate app groups for separate targets.

Unfortunately, you need a separate Notification Service Extension for each application. There might be a workaround with writing a custom build script that dynamically sets the bundle_id of the NotificationServiceExtension based on the containing Apps bundle_id, but this is outside the scope of iZooto.

📘

Still having problems? We're happy to help!

If you are still having issues after following the steps above or the issue is something not discussed above, simply email us at [email protected].

Include as much as you can of the following data to help us find you a solution quicker:

  • Our SDK Version
  • Device OS Version
  • XCode crash log or stack trace of the app starting and the problem point
  • Any other libraries or plugins in your app
  • Details on reproducing the problem