简体   繁体   中英

What does "Product > Build" do in Xcode versus "Build For"?

The "Product" menu in Xcode has "Build" ( + B ) and it has "Build For" which has three options: "Testing", "Running", and "Profiling".

Xcode 中产品菜单的屏幕截图

Is there a difference between "Build" and "Build For" > "Running"? If yes, what is it (is it supposed to build for all three options in one go?) and is there any way to modify what gets built? If not, then why bother having two separate commands?

I have tried looking up documentation on this but it doesn't answer my question.

This question is similar but doesn't answer it either (and is quite old).

I am using Xcode 14.2.

"Build" (Cmd+B) is the same as the "Build For" -> "Running" menu combination (Shift+Cmd+R). I have never seen any difference between the two. Choosing "Run" (Cmd+R) after either "Build" or "Build For" -> "Running" always gives the same result.

"Build" definitely does not perform all three builds. If you change some code then do "Build" followed by "Build For" -> "Running", the second doesn't do anything since the first already did the work. But if you change some code then do "Build" followed by "Build For" -> "Testing", then you will see two builds happen, the first for running, the second for testing.

I have not seen a way to change the "Build" menu from "Build For Running" to any of the other builds. It really does seem redundant to have the "Build" menu. There's nothing related in the scheme editing screens, for example.

You could change the key bindings in Xcode -> Preferences -> Key Bindings. You can change Cmd+B to trigger the desired "Build For" submenu instead of the "Build" menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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