简体   繁体   English

使用xcodebuild命令行将应用程序放在iPhone上

[英]using xcodebuild command line to put an app on the iPhone

Is this possible? 这可能吗? How does Xcode actually deploy iPhone apps that were built into the iPhone? Xcode实际上如何部署内置在iPhone中的iPhone应用程序?

Or is there another tool which I'm missing out on? 还是我错过了另一种工具?

clarification: by "deploy" I mean actually install and run gdb on the iPhone like when you do run>debug 澄清:通过“部署”,我的意思是实际在iPhone上安装并运行gdb,就像您运行run> debug时一样

xcodebuild only builds targets, it does not run executables; xcodebuild仅构建目标,不运行可执行文件; there's no way for it to invoke the code that transfers an iPhone app to a device and starts the debugger. 它无法调用将iPhone应用程序传输到设备并启动调试器的代码。

xcodebuild is what Xcode uses under the cover the build iPhone apps. Xcodebuild是Xcode在构建iPhone应用程序的幕后使用的东西。 So you can definitely use it to build the app. 因此,您绝对可以使用它来构建应用程序。 Just cd into the directory in which your project resides and then execute xcodebuild: 只需cd进入项目所在的目录,然后执行xcodebuild:

cd myProjectDir
xcodebuild

This will build the project in that directory, much in the same way as if you'd hit Build from xcode. 这将在该目录中构建项目,就像您从xcode中单击Build一样。

One thing you cannot do with xcodebuild is deploy the app to the iPhone. 使用xcodebuild无法做的一件事是将应用程序部署到iPhone。 If you want to do this I beleive the simplest way is to use Xcode. 如果您想这样做,我相信最简单的方法是使用Xcode。 If you want to automate this I would suggest using AppleScript. 如果要自动执行此操作,建议使用AppleScript。

You can find out more about xcodebuild here , a page which includes the following description of xcodebuild: 您可以在此处找到有关xcodebuild的更多信息,该页面包含xcodebuild的以下描述:

Run xcodebuild from the directory containing your project (ie the directory containing the projectname.xcodeproj package). 从包含您的项目的目录(即包含projectname.xcodeproj包的目录)运行xcodebuild。 If you have multiple projects in this directory you will need to use -project to indicate which project should be built. 如果此目录中有多个项目,则需要使用-project指示应构建哪个项目。

By default, xcodebuild builds the first target listed in your project, with the default build configuration. 默认情况下,xcodebuild使用默认的构建配置来构建项目中列出的第一个目标。 The order of the targets is a property of the project and is the same for all users of the project. 目标的顺序是项目的属性,并且对项目的所有用户而言都是相同的。 The active target and active build configuration properties are set for each user of the project and can vary from user to user. 为项目的每个用户设置了活动目标和活动构建配置属性,并且属性因用户而异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM