Common iOS Build and Runtime Issues in Xcode Development
Reversing Build Order in Xcode
To adjust the build sequence, reorder targets manually in the project’s Build Phases → Dependencies section or modify the Build Rule priority in the target’s Build Settings.
Clearing Xcode Derived Data Cache
- Open Xcode Preferences with Cmd + ,.
- Navigate to the Locations tab.
- Click the arrow next to Derived Data, then delete the contents of the opened folder.
Fixing "Command PhaseScriptExecution Failed" Error
This error commonly arises from outdated shell script syntax in custom build scripts (e.g., CocoaPods post-install hooks). Locate all instances of:
source="$(readlink ${source})"
and replace them with:
source="$(readlink -f ${source})"
Ensure -f is included to resolve nested symlinks correctly.
Resolving iOS Simulator Boot Failures
Option 1: Purge CoreSimulator Caches
Run the following in Temrinal:
open ~/Library/Developer/CoreSimulator/Caches
Then manually delete the entire Caches folder.
Option 2: Reset via Command Line
sudo killall Simulator
rm -rf ~/Library/Developer/CoreSimulator/Caches
# Launch Simulator again from Xcode or Dock
Bypassing App Transport Security (ATS) Restrictions
When loading HTTP resources, ATS blocks insecure connections by default. To allow exceptions:
- In
Info.plist, add a new key:NSAppTransportSecurity(Dictionary type). - Inside it, add a boolean key
NSAllowsArbitraryLoadsand set its value toYES.
⚠️ Only use this for development or internal services. Production apps should enforce HTTPS.
Resolving Swift Pod Module Import Errors
If a Swift pod (e.g., DKPhotoGallery) depends on a non-modular Objective-C library like SDWebImage, Xcode fails to generate module maps. Fix by updating your Podfile:
# Option A: Apply globally
use_modular_headers!
# Option B: Apply selectively
target 'YourApp' do
use_frameworks!
pod 'DKPhotoGallery'
pod 'SDWebImage', :modular_headers => true
end
Then run pod deintegrate && pod install.
Installing Missing iOS Simulator Runtimes Manually
If Xcode fails to download simulator runtimes via Preferences → Components:
- Download the
.dmgfile directly from Apple Developer Downloads. - Install it using:
xcrun simctl runtime add /path/to/iOS_17.4_Simulator_Runtime.dmg - Restart Xcode and verify under Xcode → Devices and Simulators → Simulators.
Restoring Missing libarclite After Upgrading to Xcode 15
Xcode 15 removes legacy ARC support files. If you see:
SDK does not contain 'libarclite' at ...
follow these steps:
- Confirm the missing path:
ls /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/ - Create the directory if absent:
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc - Download the correct
libarclitebinary:- For simulator builds:
libarclite_iphonesimulator.a - For device builds:
libarclite_iphoneos.a
- For simulator builds:
- Copy the appropriate file into the
arc/folder. - Clean and rebuild the project.