Last modified February 11, 2016 by Shelly Wolfe

How Do I Exclude Optional iOS Frameworks?

As of Swrve iOS SDK version 4.2, it is possible to exclude certain iOS frameworks that aren’t relevant to your app.

SDK Version 4.2 to 4.11.4

In Swrve SDKs v4.2 to v4.11.4, you must add the following Preprocessor Macros to exclude the associated framework.

Preprocessor Macros Framework
SWRVE_NO_ADDRESS_BOOK AddressBook.framework
Contacts.framework
SWRVE_NO_LOCATION CoreLocation.framework
SWRVE_NO_PHOTO_LIBRARY AssetsLibrary.framework
Photos.framework
SWRVE_NO_PHOTO_CAMERA N/A – restricts camera access in the AVFoundation.framework
SWRVE_NO_PUSH UserNotificationsUI.framework
UserNotifications.framework
Removes push code in the final app.

SDK Version 5.0+

In Swrve SDK v5.0, the above optional frameworks are excluded by default. We have changed the above macros to the following and you now must add the Preprocessor Macros to include the associated framework (with the exception of SWRVE_NO_PUSH – see note below):

Preprocessor Macros Framework
SWRVE_ADDRESS_BOOK AddressBook.framework
Contacts.framework
SWRVE_LOCATION CoreLocation.framework
SWRVE_PHOTO_LIBRARY AssetsLibrary.framework
Photos.framework
SWRVE_PHOTO_CAMERA N/A – restricts camera access in the AVFoundation.framework
The process to exclude push code in your app remains the same. You must add the SWRVE_NO_PUSH macro to remove the code.

Native iOS

To include the frameworks in your app, add the following Preprocessor Macros to App Target > Build Settings > Preprocessing > Preprocessor Macros:

Apps Integrated with CocoaPods

You must apply the preprocessor macros to the Pods project that CocoaPods automatically creates. To add these automatically, add the following snippet to your Podfile:

Apps Integrated with Carthage

You must apply the preprocessor macros to the SwrveFrameworks project found in the Carthage/Checkouts/swrve-ios-sdk/SwrveFrameworks folder and then run a Carthage build to update your main project.

Unity iOS

Unity SDK

SDK Version 4.2 to 4.11.4

You must apply the preprocessor macros to the Xcode project that Unity automatically creates. To add these automatically, you need to add to the Unity post processor (Assets/Swrve/Editor/SwrveIOSPostProcess.cs) to remove those frameworks.

There are two required steps:

  1. Comment out the unneeded Frameworks:
  2. Add the Preprocessor Macros by adding the following lines:

SDK Version 5.0+

In Swrve SDK v5.0, the above optional frameworks are excluded by default. We have changed the above macros to the following and you now must add the Preprocessor Macros to include the associated framework by modifying a Unity postprocess class that adds those frameworks and build flags:

  1. Add the required Frameworks:
  2. Add the Preprocessor Macros by adding the following lines: