ios - 查找 iOS 模拟器应用程序的路径
<p><p>我想从命令行运行<strong>模拟器</strong>。有没有办法通过<strong>命令行</strong>找到<strong>模拟器路径</strong>。 Apple 经常更改模拟器位置,例如</p>
<pre><code>/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
/Applications ........ / IOS simulato....
</code></pre>
<p>有没有办法从终端找到模拟器路径。 ?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>这里有两个建议:</p>
<ul>
<li><p>您可以使用 <code>xcode-select</code> 打印 Xcode 的路径:</p>
<pre><code># 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
</code></pre> </li>
<li><p>可以使用<code>xcrun</code>找到iphonesimulator SDK中的一个xcodebuild工具的路径,然后从这里推导出路径:</p>
<pre><code># 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
</code></pre> </li>
</ul></p>
<p style="font-size: 20px;">关于ios - 查找 iOS 模拟器应用程序的路径,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/12675965/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/12675965/
</a>
</p>
页:
[1]