Are you still waiting for a long iOS build process? Let's try to quickly build and run the iOS app through the command line.
Needless to say, Xcode is so slow as we all know. What's more, I sometimes find myself too dependent on the Automatic completion function of Cocoa Touch. This is a combination of angels and demons!
Therefore, I began to find an alternative process to implement the functions I needed through the command line. The results are quite confusing: some articles suggest using xctool and xcodebuild to build Xcode target applications, and then using ios-sim, simctrl, and instruments to manage and run simulators, however, most of the information is outdated and fragmented.
Fortunately, I finally pieced together the trivial information to achieve my goal. That is, if there is an iOS project created through Xcode 6, I want to do the following:
- Build target application
- Start an iOS Simulator
- Install the app on the started simulator.
- Run the installed app
- Uninstall the app from the simulator
So I want to implement all these tasks through the command line, that is, to close Xcode to complete these tasks.
Before we proceed, you need to collect the following basic information:
- Scheme (for example, "AwesomeApp") created by using Xcode ")
- Your application package id (for example, "com. awesome. app ")
- The name of the created simulator (for example, "iPhone6 Plus "). If you do not want to obtain this information from the Xcode GUI, you can collect it by viewing the output of the xcrun simtl list command.
Are you ready? Let's get started!
(Note that the following commands must be run in your project folder)
Target Architecture Application:
xcodebuild -scheme AwesomeApp -destination 'platform=iphonesimulator,name=iPhone 6 Plus' -derivedDataPath build
Start the running simulator:
xcrun instruments -w 'iPhone 6 Plus'
Install the application package (of course, you need to run this command after you build the target application and start the simulator)
xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/AwesomeApp.app
Start the application that has been installed in the simulator (after the application has been installed using the preceding command)
xcrun simctl launch booted com.awesome.app
Delete the installation package:
xcrun simctl uninstall booted com.awesome.app
If you want to build a complex project, you actually need to specify a lot of parameters for the build command. Read The Fucking Manuals: Read The damn user manual !). If you are a slot like me, write some scripts to automatically complete these steps.
------------------
Http://dduan.net/post/2015/02/build-and-run-ios-apps-in-commmand-line/.
Repost, please respect originality/Translation |
Public Account |
CSDN |
Tiandihui Zhuhai sub-Rudder |
Service No.: TechGoGoGo |
Http://blog.csdn.net/zhubaitian |
Excellent resource recommendation |
Address |
Comments |
DoctorQ blog |
Http://testerhome.com/doctorq/topics |
Talented in the android automation field, Pioneer in technology sharing, |