ios模拟器构建

Pod安装依赖项

 吊舱安装 

通过以下命令查找iphonesimulator版本

  xcodebuild -showsdks 

为模拟器构建

  xcodebuild -sdk iphonesimulator [版本] -workspace [projectName] .xcworkspace -scheme [projectName] -configuration [buildType] 
 注意: 
-iphonesimulator的[version]从xcodebuild -showsdks获取
- [项目名称] xcworkspace的名称
- [buildType]是Debug或Release
 例: 
xcodebuild -sdk iphonesimulator11.4-配置发布-workspace AnoMous.xcworkspace -scheme AnoMous

查找模拟器版本

  〜/ Library / Developer / Xcode / DerivedData / [projectName] - [buildhash] / Build / Products / [buildType] -iphonesimulator / [projectName] .app 
 例: 
〜/ Library / Developer / Xcode / DerivedData / AnoMous-frateghkqdqoqgaixsbpginewyoo / Build / Products / Release-iphonesimulator / AnoMous.app

使用模拟器:

  • 启动模拟器
  #查看模拟器列表: 
xcrun simctl列表
  #启动模拟器: 
xcrun文书-w'iPhone X '
  • [projectName] .app拖放到模拟器中进行安装
  • 或使用命令安装具有特定路径的应用程序
  #将应用程序安装到模拟器: 
xcrun simctl安装启动的/path/to/your-app.app

完整的示例构建并安装到模拟器:

  xcrun文书-w'iPhone X ' 
吊舱安装
  xcodebuild -sdk iphonesimulator 11.4-配置发布-workspace AnoMous .xcworkspace -scheme AnoMous 
  xcrun simctl install booted`ls -1 -d -t〜/ Library / Developer / Xcode / DerivedData / * / Build / Products / *-iphonesimulator / *。app | 头-n 1` 

邮编模拟器版本:

  • 查找.app构建并将其压缩
  • 或使用命令行
 同上-ck --sequesterRsrc --keepParent`ls -1 -d -t〜/ Library / Developer / Xcode / DerivedData / * / Build / Products / *-iphonesimulator / *。app |  head -n 1` path / to / YourApp.zip