Is it possible to build an xcode project for iPhone and have it install the result on a connected device without actually running the application? I'm currently using Build & Run, but I'm debugging a peer to peer game, so I ha开发者_StackOverflowve to build & run for two different devices, stop tasks on each of those and then build & run on the simulator so all three have the latest build. I'd love to not have to wait for the application to run on the two devices in this process.
You can drag and drop the built app (in your project build directory) into the Applications list of your device in the Organizer window.
Things have changed a little since this answer...
For simulator, you can drag/drop your recently-built app product from the Products folder in the Project Navigator straight onto the simulator window.
For a device, drag and drop the app product into "Installed Apps" when viewing the device in the "Devices" window.
If you're not quite sure where the built app is (the project build directory):
Xcode → Preferences → Locations tab → Derived Data will show the location.
There's more information in this question: Xcode 4 - build output directory
There's another way to get it to install automatically without launching. Maybe not as useful for the OP's situation, but in my case I'm trying to profile app load times so I want to start the app without the debugger attached (which can slow down execution.)
Under the target scheme, right click and select "Edit Scheme". Make sure the run configuration is selected, and then look in the info panel. There's an option that says "Launch" - set this to "Wait for executable to be launched."
Now once it's installed it will wait for you to launch the app before attaching the debugger. However, you can just hit "Stop" in Xcode and then launch the app manually. It seems to crash the first time but on second run seems to work OK. Maybe a little hacky but less manual steps than the other methods. Tested on Xcode 7.
精彩评论