【问题标题】:Building and launching app in Simulator from terminal从终端在模拟器中构建和启动应用程序
【发布时间】:2020-07-31 02:45:42
【问题描述】:

我想使用 shell 脚本而不是 Xcode 来构建和启动我的 iOS 应用程序。我的问题与这个问题类似:How to launch an iOS app in the simulator without XCode rebuilding the app,这是在 2012 年提出的。

表示可以使用项目目录下build目录下创建的IPA文件。我在我的项目文件夹中找不到构建目录。另外,我想从脚本构建应用程序。

使用终端命令在模拟器上构建和运行应用程序的最新方法是什么?

编辑:

我从命令行构建了应用程序:

xcrun xcodebuild \
  -scheme UITestingTutorial \
  -project UITestingTutorial.xcodeproj \
  -configuration Debug \
  -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.6' \
  -derivedDataPath \
  build

但是我现在如何启动它呢?

【问题讨论】:

    标签: ios xcode scripting simulator xctool


    【解决方案1】:

    在您的项目目录中运行此脚本将以编程方式启动应用程序。

    xcrun xcodebuild \
    -scheme UITestingTutorial \
    -project UITestingTutorial.xcodeproj \
    -configuration Debug \
    -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.6' \
    -derivedDataPath \
    build
    
    open -a "Simulator"
    
    # This simulator id has been manually found
    # by running 'xcrun simctl list' and searching
    # for iPhone 11 under iOS 13.6 under Devices 
    # A script can be written to automatically find this.
    xcrun instruments -w 3100E7BC-0B95-4B3E-B0DC-8743FFCB731A
    xcrun simctl install 3100E7BC-0B95-4B3E-B0DC-8743FFCB731A ./build/Build/Products/Debug-iphonesimulator/UITestingTutorial.app (http://uitestingtutorial.app/)
    xcrun simctl launch 3100E7BC-0B95-4B3E-B0DC-8743FFCB731A com.codepro.UITestingTutorial
    

    您可以参考Launch apps in iOS Simulator using Terminal了解更多详情。请注意 xctool 已弃用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-30
      • 1970-01-01
      • 1970-01-01
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 2022-06-15
      相关资源
      最近更新 更多