Manual plugin integration for iOS (in case your dependencies do not support `use_frameworks!`) - infobip/mobile-messaging-react-native-plugin GitHub Wiki
Deprecated
: Starting from 6.2.0 plugin version you can integrate plugin without use_frameworks!, check the migration guide.
Some Cocoapod dependencies may not support building as dynamic framework, it may arise following error with use_frameworks! added to the Podfile, when you are doing pod install:
[!] The 'Example' target has transitive dependencies that include statically linked binaries: ...
You can use Manual integration for iOS in this case.
- Carthage (brew install carthage), version upper 0.37.0
If previously MobileMessaging plugin was integrated automatically, following steps better to do before doing manual integration:
- cleanup pods -
cd ios & pod deintegrate & pod update- cleanup Xcode derived data -
Product->Clean Build Folderin Xcode and from Terminalrm -rf ~/Library/Developer/Xcode/DerivedData/*- npm start --reset-cache
-
Disable autolinking for plugin - add
react-native.config.jsfile or edit your current.module.exports = { dependencies: { 'infobip-mobile-messaging-react-native-plugin': { platforms: { ios: null, }, }, }, }; -
npm install infobip-mobile-messaging-react-native-plugin -
Build MobileMessaging.framework
cd node_modules/infobip-mobile-messaging-react-native-pluginnpm run mm_build
-
Open your Main app targets'
General settingstab in Xcode, scroll to theFrameworks, Libraries, and Embedded Contentsection, drag and dropMobileMessaging.xcframeworkfrom thenode_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Buildfolder. In the "Embed" section, select "Embed and sign" from the pulldown menu.
- In the targets
Build Settingstab add path"$(SRCROOT)/../node_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Build"to theFramework Search Paths. This needs to be done for Main app target and forMobileMessagingNotificationExtensiontarget as well.
- Drag and drop
node_modules/infobip-mobile-messaging-react-native-plugin/ios/MobileMessagingPluginfolder to your project in xCode, chooseCopy items if neededandCreate groupsoptions. Add files to your main application target.
- Add bridging header, if it's not exist - create
<MainTarget>-Bridging-Header.hfile and setup it asObjective-C Bridging HeaderinBuild Settingsfor you Main app target. Add it to bridging header:#import <React/RCTBridgeModule.h> #import <React/RCTEventEmitter.h> #import <React/RCTViewManager.h>
If you have any problems with creating Bridging Header, just create and add temporary .swift file to your project, xCode will automatically provide dialog with option "Create Bridging Header". After that you can delete this .swift file.
- c,d steps from Quick Start Guide->Configure Platforms->iOS
Integrating Notification Service Extension
-
Install and run our special Ruby Gem called "mmine" as described in the 1st step of Notification Service Extension setting up Xcode project instruction
-
Specify path to
MobileMessaging.xcframeworkinFramework Search PathforMobileMessagingNotificationExtensiontarget as described in the 5th step of Manual integration steps.
How to return back to normal integration, since starting from 6.2.0 plugin version it can be used without use_frameworks!.
-
Enable back autolinking for plugin - remove
react-native.config.jsfile or remove following from it.module.exports = { dependencies: { 'infobip-mobile-messaging-react-native-plugin': { platforms: { ios: null, }, }, }, }; -
Reinstall plugin
npm uninstall infobip-mobile-messaging-react-native-plugin && npm install infobip-mobile-messaging-react-native-plugin -
Open your Main app targets'
General settingstab in Xcode, scroll to theFrameworks, Libraries, and Embedded Contentsection, removeMobileMessaging.xcframework, repeat the same for the NotificationExtension target if applicable. -
In the targets
Build Settingstab remove path"$(SRCROOT)/../node_modules/infobip-mobile-messaging-react-native-plugin/ios/Carthage/Build"from theFramework Search Paths. This needs to be done for Main app target and forMobileMessagingNotificationExtensiontarget as well. -
Remove group
MobileMessagingPluginwith files inside it from your project in xCode -
From the ios folder perform
pod deintegrate && pod install -
You can remove BridgingHeader file if you don't have other swift files in your project's main target.
-
In the
AppDelegate.mfile change@import MobileMessagingto the#import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>