iOS Setup
Once you've installed @deploypulseio/react-native-code-push, you need to integrate it into your Xcode project. If you are using Expo managed workflow, see Expo Setup instead. No native file editing is required.
Install CocoaPods dependencies
cd ios && pod install && cd ..
Patch AppDelegate
Swift (recommended)
Open AppDelegate.swift and add the import:
import CodePush
Then find and replace the bundleURL() method:
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
CodePush.bundleURL()
#endif
}
Objective-C
Open AppDelegate.m and add the import:
#import <CodePush/CodePush.h>
Then find and replace the sourceURLForBridge method:
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [CodePush bundleURL];
#endif
}
Add keys to Info.plist
Add your deployment key and the DeployPulse server URL to Info.plist:
<key>CodePushDeploymentKey</key>
<string>YOUR_IOS_DEPLOYMENT_KEY</string>
<key>CodePushServerURL</key>
<string>https://apps.deploypulse.io</string>
CodePushServerURL is optional with @deploypulseio/react-native-code-push, which already defaults to
https://apps.deploypulse.io. Keep it if you would rather the configuration be explicit, or if some
builds point at a different server.
Retrieve your deployment key with:
dpctl deployment list <AppName>
HTTP exception domains (ATS)
The CodePush plugin makes HTTPS requests to the following domains. If you need to configure ATS exceptions, add them to Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>apps.deploypulse.io</key>
<dict><!-- ATS options --></dict>
</dict>
</dict>
Domains in use: apps.deploypulse.io, codepush.blob.core.windows.net, codepushupdates.azureedge.net.
api.deploypulse.io is an alias for the same service. If your app is configured with that hostname
instead, add it to the exception list rather than apps.deploypulse.io.
Code Signing (optional)
To verify bundle integrity before applying updates, add your public key to Info.plist:
<key>CodePushPublicKey</key>
<string>-----BEGIN PUBLIC KEY-----
YOUR_PUBLIC_KEY_HERE
-----END PUBLIC KEY-----</string>
See the Code Signing guide for full setup instructions.
Next step
Return to the React Native SDK page for usage and notifyAppReady instructions.
