有没有一种快速的方法来构建和安装到iPhone(来自XCode)而无需启动应用程序?

时间:2022-02-26 17:07:06

In XCode, I can use CMD-R to run (or CMD-Y to debug), and my app will compile, install on the phone & start-up. (I've already prepped my phone & XCode so this part works as expected.)

在XCode中,我可以使用CMD-R运行(或CMD-Y进行调试),我的应用程序将编译,安装在手机和启动。 (我已经准备好了我的手机和XCode,所以这部分按预期工作。)

What I'd LIKE to do is type CMD-<something else> and have my program compile & install on the phone, but NOT start-up.

我喜欢做的是键入CMD- 并让我的程序在手机上编译和安装,但不要启动。

I realize that I can just CMD-B to build, then go through some rigamarole to deploy, but I'm hoping one of you smart-folk can tell me the lazy-man's shortcut for all of this.

我意识到我可以只用CMD-B来构建,然后经过一些严格的部署,但我希望你们中的一个聪明人可以告诉我懒人的所有这一切的捷径。

Thanks!

4 个解决方案

#1


4  

Hey Olie, I haven't tried this because I don't have an iPhone to deploy to at the moment, but this /should/ work:

嘿,奥利,我没有尝试过这个,因为我现在没有iPhone部署,但是/应该/工作:

You can create a script which runs xcodebuild in your current project directory and give it the install target. Assuming you're going to want to debug at sometime, use the Debug configuration, otherwise use release. Then bind the script to some command key in the Xcode preferences and you should be on your way. To launch xcodebuild with debug you would do something like:

您可以创建一个在当前项目目录中运行xcodebuild的脚本,并为其指定安装目标。假设您希望在某个时候进行调试,请使用Debug配置,否则请使用release。然后将脚本绑定到Xcode首选项中的某个命令键,您应该在路上。要通过调试启动xcodebuild,您可以执行以下操作:

xcodebuild install -configuration Debug

If you have more than one target in your project you will have to specify that to xcodebuild as well:

如果项目中有多个目标,则必须将其指定给xcodebuild:

xcodebuild install -target iPhoneApp -configuration Debug

You could also create a configuration specific to this scenario in your projects and pass that to xcodebuild and you should be able to script this in your favorite supported language (i.e., AppleScript, python, ruby, etc.).

您还可以在项目中创建特定于此场景的配置,并将其传递给xcodebuild,您应该能够使用您最喜欢的支持语言(即AppleScript,python,ruby等)编写脚本。

HTH

#2


1  

I had the same question.

我有同样的问题。

I ended up using the XCode Organizer. Select your current device. Summary Tab. "+" Applications..then select the one you just built (under /build/[debug|release]-iphoneos/.app

我最终使用了XCode Organizer。选择您当前的设备。摘要选项卡。 “+”应用程序..然后选择你刚构建的那个(在/build/[debug|release]-iphoneos/.app下)

This does the install very easily.

这很容易安装。

#3


0  

Have you looked into using Automator? Here's a good write up on how to automate XCode to build and what not.

您是否考虑过使用Automator?这里有一篇关于如何自动化XCode构建和不构建的文章。

#4


0  

To build (exact flags documented under "man xcodebuild", install xcode's command line tools):

要构建(在“man xcodebuild”下记录的确切标志,请安装xcode的命令行工具):

xcodebuild build -sdk iphoneos6.0 workspace/project, targets, configs and/or scheme flags

To install (grab from github here then simply make and run):

要安装(从github抓取,然后简单地制作并运行):

path/to/fruitstrap --id device-uuid-to-install-on --bundle path/to/ios.app

#1


4  

Hey Olie, I haven't tried this because I don't have an iPhone to deploy to at the moment, but this /should/ work:

嘿,奥利,我没有尝试过这个,因为我现在没有iPhone部署,但是/应该/工作:

You can create a script which runs xcodebuild in your current project directory and give it the install target. Assuming you're going to want to debug at sometime, use the Debug configuration, otherwise use release. Then bind the script to some command key in the Xcode preferences and you should be on your way. To launch xcodebuild with debug you would do something like:

您可以创建一个在当前项目目录中运行xcodebuild的脚本,并为其指定安装目标。假设您希望在某个时候进行调试,请使用Debug配置,否则请使用release。然后将脚本绑定到Xcode首选项中的某个命令键,您应该在路上。要通过调试启动xcodebuild,您可以执行以下操作:

xcodebuild install -configuration Debug

If you have more than one target in your project you will have to specify that to xcodebuild as well:

如果项目中有多个目标,则必须将其指定给xcodebuild:

xcodebuild install -target iPhoneApp -configuration Debug

You could also create a configuration specific to this scenario in your projects and pass that to xcodebuild and you should be able to script this in your favorite supported language (i.e., AppleScript, python, ruby, etc.).

您还可以在项目中创建特定于此场景的配置,并将其传递给xcodebuild,您应该能够使用您最喜欢的支持语言(即AppleScript,python,ruby等)编写脚本。

HTH

#2


1  

I had the same question.

我有同样的问题。

I ended up using the XCode Organizer. Select your current device. Summary Tab. "+" Applications..then select the one you just built (under /build/[debug|release]-iphoneos/.app

我最终使用了XCode Organizer。选择您当前的设备。摘要选项卡。 “+”应用程序..然后选择你刚构建的那个(在/build/[debug|release]-iphoneos/.app下)

This does the install very easily.

这很容易安装。

#3


0  

Have you looked into using Automator? Here's a good write up on how to automate XCode to build and what not.

您是否考虑过使用Automator?这里有一篇关于如何自动化XCode构建和不构建的文章。

#4


0  

To build (exact flags documented under "man xcodebuild", install xcode's command line tools):

要构建(在“man xcodebuild”下记录的确切标志,请安装xcode的命令行工具):

xcodebuild build -sdk iphoneos6.0 workspace/project, targets, configs and/or scheme flags

To install (grab from github here then simply make and run):

要安装(从github抓取,然后简单地制作并运行):

path/to/fruitstrap --id device-uuid-to-install-on --bundle path/to/ios.app