3

コマンドラインからシミュレーターを実行したい。コマンドラインからシミュレータパスを見つける方法はありますか?Appleは頻繁にシミュレータの場所を次のように変更します

/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator

/Applications ........ / IOS simulato....

ターミナルからシミュレータパスを見つける方法はありますか??

4

1 に答える 1

5

ここに2つの提案があります:

  • xcode-selectXcodeへのパスを印刷するために使用できます。

    # This returns sthg like "/Applications/Xcode.app/Contents/Developer"
    XCODEPATH=$(xcode-select --print-path)
    # Then build the rest of the path to the simulator SDK
    SIMSDKPATH=${XCODEPATH}/Platforms/iPhoneSimulator.platform/Developer
    # And add the rest of the path to the Simulator app
    SIMULATORPATH=$(SIMSDK}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
    
  • を使用xcrunして、iphonesimulator SDKでxcodebuildツールのパスを検索し、ここからパスを差し引くことができます。

    # This returns sthg like "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc"
    GCCPATH=$(xcrun -sdk iphonesimulator -find gcc)
    # Then go up 3 directories
    SIMSDKPATH=$(dirname $(dirname $(dirname ${GCCPATH})))
    # And down to the Simulator app
    SIMULATORPATH=${SIMSDKPATH}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
    
于 2012-10-01T15:27:07.467 に答える