iOS Device Setup Guide
iOS Device Setup Guide
Section titled “iOS Device Setup Guide”This guide will walk you through setting up your development environment to run the Bartendie app on a physical iPhone connected to your Mac.
Prerequisites
Section titled “Prerequisites”- Mac with Xcode installed (latest version recommended)
- Physical iPhone connected via USB cable
- Apple Developer Account (free account works for development)
- iPhone unlocked and trusted on your Mac
Step 1: Connect Your iPhone
Section titled “Step 1: Connect Your iPhone”- Connect your iPhone to your Mac using a USB cable
- Unlock your iPhone
- If prompted, tap “Trust This Computer” on your iPhone
- Enter your iPhone passcode if requested
Step 2: Verify Device Connection
Section titled “Step 2: Verify Device Connection”Check that your Mac recognizes your iPhone:
# List all connected iOS devicesxcrun xctrace list devicesYou should see your iPhone listed with its name and UDID.
Alternatively, you can check in Xcode:
- Open Xcode
- Go to Window → Devices and Simulators (or press
Cmd + Shift + 2) - Your iPhone should appear in the left sidebar under “Devices”
Step 3: Configure Xcode Signing
Section titled “Step 3: Configure Xcode Signing”-
Open the iOS project in Xcode:
Terminal window cd shakeropen ios/Bartendie.xcworkspace -
In Xcode:
- Select the Bartendie project in the navigator
- Select the Bartendie target
- Go to the Signing & Capabilities tab
- Check “Automatically manage signing”
- Select your Team from the dropdown (your Apple ID)
- Xcode will automatically create a provisioning profile
-
If you see any errors:
- Make sure you’re signed in to Xcode with your Apple ID: Xcode → Settings → Accounts
- Add your Apple ID if it’s not already there
- For a free account, you may need to accept the Apple Developer Agreement
Step 4: Build and Run on Device
Section titled “Step 4: Build and Run on Device”Option 1: Using npm script (Recommended)
Section titled “Option 1: Using npm script (Recommended)”The project includes a script that automatically detects your connected device:
cd shakernpm run ios:deviceThis will:
- Automatically detect your connected iPhone
- Build the app
- Install it on your device
- Start the Metro bundler
Option 2: Using Expo CLI
Section titled “Option 2: Using Expo CLI”cd shakernpm run start:iosThen in the Expo Dev Tools, press i to select your device, or scan the QR code with your iPhone’s camera (if on the same network).
Option 3: Using Xcode directly
Section titled “Option 3: Using Xcode directly”-
Open the workspace:
Terminal window cd shakeropen ios/Bartendie.xcworkspace -
In Xcode:
- Select your iPhone from the device dropdown (next to the play button)
- Click the Play button (or press
Cmd + R) - Xcode will build and install the app on your device
Step 5: Trust the Developer Certificate (First Time Only)
Section titled “Step 5: Trust the Developer Certificate (First Time Only)”When you first launch the app on your iPhone:
- The app will appear on your home screen
- When you try to open it, you’ll see: “Untrusted Developer”
- Go to Settings → General → VPN & Device Management (or Device Management)
- Tap on your developer certificate (your Apple ID email)
- Tap “Trust [Your Apple ID]”
- Confirm by tapping “Trust”
- Return to the home screen and open the app
Step 6: Configure Network Access (For Development)
Section titled “Step 6: Configure Network Access (For Development)”Since the app uses --localhost flag, you need to ensure your iPhone can connect to your Mac’s Metro bundler:
Option A: Same Wi-Fi Network (Recommended)
Section titled “Option A: Same Wi-Fi Network (Recommended)”- Make sure both your Mac and iPhone are on the same Wi-Fi network
- Find your Mac’s local IP address:
Terminal window ipconfig getifaddr en0 - Update the Metro bundler connection:
- When Metro starts, it will show a QR code
- Shake your iPhone to open the developer menu
- Select “Configure Bundler”
- Enter your Mac’s IP address (e.g.,
192.168.1.100:8081)
Option B: Use USB Connection (Expo)
Section titled “Option B: Use USB Connection (Expo)”If using Expo Dev Client, you can use USB connection:
- The
--localhostflag may need to be removed for USB tunneling - Or use
expo start --tunnelfor a cloud connection
Troubleshooting
Section titled “Troubleshooting”Device Not Detected
Section titled “Device Not Detected”-
Check USB connection: Try a different cable or USB port
-
Restart services:
Terminal window # Kill any running Metro bundlerskillall node# Restartnpm run ios:device -
Check Xcode: Make sure Xcode is up to date and Command Line Tools are installed:
Terminal window xcode-select --install
Build Errors
Section titled “Build Errors”-
“ld: framework ‘React’ not found” (linker can’t find React-Core-prebuilt):
Do a full clean and reinstall of iOS native deps:
Terminal window cd shakernpm run cleanrm -rf ios/Pods ios/Podfile.lock ios/buildcd iospod installcd ..npm run ios:deviceIf it still fails, clear Xcode DerivedData then rebuild:
Terminal window rm -rf ~/Library/Developer/Xcode/DerivedDatacd shaker && npm run ios:device -
Other build failures – clean build folder:
Terminal window cd shakernpm run cleancd iospod install -
Check signing: Ensure your Apple ID is added in Xcode Settings → Accounts
-
Update CocoaPods:
Terminal window cd shaker/iospod install --repo-update
App Crashes on Launch
Section titled “App Crashes on Launch”-
Check device logs in Xcode: Window → Devices and Simulators → Select your device → View Device Logs
-
Verify network connection: Make sure Metro bundler is running and accessible
-
Clear app data: Delete the app from your iPhone and reinstall
Metro Bundler Connection Issues
Section titled “Metro Bundler Connection Issues”-
Check firewall: Make sure your Mac’s firewall allows connections on port 8081
-
Use tunnel mode (if on different networks):
Terminal window npm run start -- --tunnel -
Check localhost setting: If using
--localhost, ensure both devices are on the same network
Quick Reference Commands
Section titled “Quick Reference Commands”# List connected devicesxcrun xctrace list devices
# Run on connected device (auto-detect)cd shaker && npm run ios:device
# Start Metro bundler onlycd shaker && npm start
# Clean and rebuildcd shaker && npm run clean && cd ios && pod installNext Steps
Section titled “Next Steps”Once your app is running on your iPhone:
- Hot Reload: Changes to your code will automatically reload on the device
- Debugging: Use React Native Debugger or Chrome DevTools
- Performance: Use Xcode Instruments for performance profiling
- Logs: View device logs in Xcode’s Devices window