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.

Source: Internet
Author: User

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:

  1. Build target application
  2. Start an iOS Simulator
  3. Install the app on the started simulator.
  4. Run the installed app
  5. 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:

  1. Scheme (for example, "AwesomeApp") created by using Xcode ")
  2. Your application package id (for example, "com. awesome. app ")
  3. 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,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.