IOS Setup
Ios Setup:
Prerequisites Mac Computer: iOS development requires macOS. Xcode: Install the latest version of Xcode from the Mac App Store. CocoaPods: Install CocoaPods (dependency manager for iOS) using:
sudo gem install cocoapodsNode.js and npm/yarn: Ensure Node.js is installed on your system. React Native CLI: If you're using the CLI (not Expo), ensure it's installed globally.
Create or Open Your React Native Project
If you haven't already created a project, do so with:
npx react-native init MyProjectNavigate to your project directory:
cd MyProjectInstall Dependencies
Navigate to the ios folder:
cd iosInstall CocoaPods dependencies:
pod installReturn to the root directory:
cd ..
Open the Project in Xcode
Open the .xcworkspace file located in the ios folder:
open ios/MyProject.xcworkspaceSet your Development Team: In Xcode, go to the Signing & Capabilities tab of your target (usually the project name). Choose a development team (you may need an Apple Developer account).
Configure the App App Icons and Launch Screen:Add your app's icons and splash screen in ios/MyProject/Images.xcassets. Permissions:Update Info.plist to request necessary permissions. For example, for camera usage:
This app requires access to the camera.Run the App on a Simulator
Start the Metro bundler:
npx react-native startRun the app:
npx react-native run-iosAlternatively, you can run the app directly from Xcode: 1. Select a simulator (e.g., iPhone 14). 2. Press the Run button (⏵).
Run on a Physical Device (Optional)
Connect your iOS device to your Mac via USB.
Ensure the device is trusted by your Mac (approve the prompt on the device).
Select your device in Xcode as the build target.
Press the Run button (⏵).
Note:To run on a physical device, you need to have a valid Apple Developer account and provisioning profile.
Debugging
Use Metro for debugging and live reloading.
In the app, shake the device or press Cmd+D (Simulator) to open the Developer Menu.
Select Enable Fast Refresh for live updates.
Testing Release Builds
Create a release build in Xcode by selecting Product > Archive.
Test on a physical device or distribute via TestFlight.
Last updated