How to launch an iOS app in the simulator without XCode rebuilding the app

早过忘川 提交于 2019-12-11 05:08:45

问题


If I've build an iOS app for the simulator using Xcode, is there a way I can manually launch this in the simulator and/or copy it from the build-dir onto the simulator? The reason being if I change any of my code, I don't want XCode to decide it's going to rebuild everything when I run in the simulator, as this takes several minutes.

I see simulator dirs are named using some sort of GUID and have some extra sub-dirs. Is there any magic to this or can I create a new dir and dump my app into it?


回答1:


First, determine where your build directory is located. This will normally be inside the root of your project directory, like this:

${PROJECT}/build

Then locate which build target you built, which will be either Debug or Release, and it should be for the iPhone Simulator. This is normally found in the build directory as one of the following:

${PROJECT}/build/Debug-iphonesimulator 

OR

${PROJECT}/build/Release-iphonesimulator

Now locate your application bundle, which will contain the actual app which can be loaded into the iOS Simulator. This will be underneath one of the directories above, as in:

${PROJECT}/build/Debug-iphonesimulator/<yourapp>.app

As I say this is an application bundle, so it's actually a directory, and inside this directory you will find the executable for your app:

${PROJECT}/build/Debug-iphonesimulator/<yourapp>.app/<yourapp>

you can now launch your app in the iOS Simulator with:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication ${PROJECT}/build/Debug-iphonesimulator/<yourapp>.app/<yourapp>


来源:https://stackoverflow.com/questions/10364647/how-to-launch-an-ios-app-in-the-simulator-without-xcode-rebuilding-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!