iOS Setup Guide
This guide provides detailed instructions for setting up Source Push in your iOS React Native application.
Prerequisites
Before you begin, ensure you have:
- Xcode installed
- CocoaPods installed
- React Native development environment set up
- Source Push account and access token
Installation Steps
1. Install the SDK
First, install the Source Push SDK in your React Native project:
npm install --save @srcpush/react-native-code-push
# or using yarn
yarn add @srcpush/react-native-code-push
2. iOS Platform Setup
Add the SDK to your Podfile
- Open your
ios/Podfile
and add:
pod 'CodePush', :path => '../node_modules/@srcpush/react-native-code-push'
- Install the pods:
cd ios && pod install
3. Configuration
Update Info.plist
Add the following to your Info.plist
:
<key>CodePushDeploymentKey</key>
<string>Your-Deployment-Key</string>
<key>CodePushServerURL</key>
<string>https://api.srcpush.com</string>
Initialize Source Push
In your AppDelegate.mm
, add the necessary imports and initialization code:
#import <CodePush/CodePush.h>
// Add this inside your didFinishLaunchingWithOptions method:
NSURL *jsCodeLocation = [CodePush bundleURL];
Advanced Configuration
Custom Update Settings
You can customize update behavior in your Info.plist
:
<key>CodePushPublicKey</key>
<string>Your-Public-Key</string>
<key>CodePushUpdateTimeout</key>
<integer>7200</integer>
Security Configuration
Enable SSL pinning for additional security:
<key>CodePushSSLPinning</key>
<true/>
Troubleshooting
Common Issues
-
Pod Installation Fails
- Clean your build folder
- Delete Pods directory
- Run
pod deintegrate
- Try installation again
-
Updates Not Installing
- Verify deployment key
- Check network connectivity
- Ensure proper entitlements
Debug Mode
Enable debug logging:
[CodePush setLogLevel:CPLogLevelDebug];
Next Steps
- Check out the API Reference for detailed SDK usage
- Learn about Release Management
- Explore Advanced Features