iOS Setup
Integrate the Turbopush SDK into your iOS React Native project to enable OTA updates on iPhones and iPads.
Once you've acquired the CodePush plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps:
-
Run
cd ios && pod install && cd ..to install the necessary CocoaPods dependencies. -
Change bundleUrl on AppDelegate file.
-
Open up the
ios/[ProjectName]/AppDelegate.swiftfile, and add an import statement for the CodePush headers; -
Find the following line of code, which sets the source URL for bridge for production release and replace it with the following line;
import React import CodePush override func bundleURL() -> URL? { #if DEBUG RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") #else Bundle.main.url(forResource: "main", withExtension: "jsbundle") CodePush.bundleURL() #endif }
- Add the CodePushDeploymentKey key (generated in the create app step) in the file
ios/[ProjectName]/Info.plist
<key>CodePushDeploymentKey</key>
<string>YOUR_IOS_DEPLOYMENT_KEY</string>- Certify that your
deployment_targetis 15.5 or higher in yourios/Podfilefile.
platform :ios, '15.5'Code Signing setup (optional)
Starting with CLI version 2.1.0 you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to relevant documentation section.
In order to configure Public Key for bundle verification you need to add record in Info.plist with name CodePushPublicKey and string value of public key content. Example:
<plist version="1.0">
<dict>
<!-- ...other configs... -->
<key>CodePushPublicKey</key>
<string>-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
-----END PUBLIC KEY-----</string>
<!-- ...other configs... -->
</dict>
</plist>How is this guide?