AGENT SKILL

mobiai-ios-build

Use when building an iOS project, configuring schemes, troubleshooting build failures, or managing dependencies with CocoaPods or SPM.

License 许可
MIT
最近更新
2026-11-13
Stars
★ 493
Forks
14

01 前言 Front Matter

name
mobiai-ios-build
license
MIT
platforms
[ "ios" ]
description
Use when building an iOS project, configuring schemes, troubleshooting build failures, or managing dependencies with CocoaPods or SPM.
compatibility
[ "claude-code", "cursor", "copilot", "codex" ]

03 SKILL.md 正文

iOS Build System

Community contribution welcome! This skill is a skeleton. Help flesh it out with real-world xcodebuild workflows and troubleshooting tips.

Build iOS projects using xcodebuild and manage dependencies with CocoaPods/SPM.

When to Use

  • Building the app for testing or deployment
  • Troubleshooting build failures
  • Managing dependencies (CocoaPods, SPM)

Build Commands

Discover Project Structure

# List schemes
xcodebuild -list

# List schemes (workspace)
xcodebuild -workspace MyApp.xcworkspace -list

# Check if it uses workspace or project
ls *.xcworkspace *.xcodeproj 2>/dev/null

Build for Simulator

# With workspace (CocoaPods projects)
xcodebuild build \
  -workspace MyApp.xcworkspace \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro' \
  -quiet

# With project (no CocoaPods)
xcodebuild build \
  -project MyApp.xcodeproj \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro' \
  -quiet

Build for Device

xcodebuild build \
  -workspace MyApp.xcworkspace \
  -scheme MyApp \
  -destination 'generic/platform=iOS' \
  CODE_SIGNING_REQUIRED=NO

Run Tests

xcodebuild test \
  -workspace MyApp.xcworkspace \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro' \
  -quiet

Clean Build

xcodebuild clean build \
  -workspace MyApp.xcworkspace \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

Dependency Management

CocoaPods

# Install dependencies
pod install

# Update a specific pod
pod update <PodName>

# Check for issues
pod outdated

Always open .xcworkspace (not .xcodeproj) after running pod install.

Swift Package Manager

SPM dependencies are defined in the Xcode project or Package.swift.

# Resolve packages
xcodebuild -resolvePackageDependencies \
  -workspace MyApp.xcworkspace \
  -scheme MyApp

# Check Package.swift
cat Package.swift

Code Signing

Development (Automatic)

Xcode handles signing automatically in most cases. For CLI builds:

xcodebuild build \
  -allowProvisioningUpdates \
  -scheme MyApp \
  -destination 'generic/platform=iOS'

Skip Signing (for CI or testing)

xcodebuild build \
  CODE_SIGNING_REQUIRED=NO \
  CODE_SIGNING_ALLOWED=NO \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

Troubleshooting

DerivedData corruption

rm -rf ~/Library/Developer/Xcode/DerivedData

Module not found

# Regenerate module maps
pod deintegrate && pod install
# Or clean SPM cache
rm -rf ~/Library/Caches/org.swift.swiftpm

Swift version mismatch

# Check Swift version
swift --version
xcrun swift --version

# Check project's Swift version
grep SWIFT_VERSION *.xcodeproj/project.pbxproj

Provisioning profile issues

# List installed profiles
ls ~/Library/MobileDevice/Provisioning\ Profiles/

Want to improve this skill? Add your xcodebuild expertise, CI/CD patterns, and signing workflows via a PR.

04 同仓库更多 Skills