如何在 Xcode 中创建一个简单的 Objective-C 命令行项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2697883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:18:09  来源:igfitidea点击:

How do you create a simple Objective-C command line project in Xcode

objective-cxcodemacos

提问by Mark

I'm moving from a C# VS2008 world into the Mac world and I just wanted to know how I can create a quick little command line based application so that I can write many little Objective-C apps without worrying about creating an iPhone app or whatever.

我正在从 C# VS2008 世界转移到 Mac 世界,我只是想知道如何创建一个快速的基于命令行的小应用程序,这样我就可以编写许多小的 Objective-C 应用程序,而不必担心创建 iPhone 应用程序或其他任何东西.

Which projects do I create in Xcode? I can see the Command Line Tool under "Mac OS X" but the only options for the type is "C", "C++", "Core Data", "Core Foundation", "Core Services" and "Foundation" but no simple Objective-C project ?

我在 Xcode 中创建哪些项目?我可以在“Mac OS X”下看到命令行工具,但类型的唯一选项是“C”、“C++”、“Core Data”、“Core Foundation”、“Core Services”和“Foundation”,但不是简单的Objective-C 项目 ?

Thanks

谢谢

回答by Ole Begemann

"Foundation" is the one you want. The Foundation framework is Apple's "standard library" for Objective-C that provides all the basic classes like NSArray, NSString, NSNumber, and much more. Since "plain" Objective-C without Foundation is not very useful for most applications, Apple probably chose to name its project template after the Foundation library.

“基础”就是你想要的。Foundation 框架是 Apple 为 Objective-C 提供的“标准库”,它提供了所有基本类,如 NSArray、NSString、NSNumber 等等。由于没有 Foundation 的“普通”Objective-C 对于大多数应用程序不是很有用,Apple 可能选择以 Foundation 库命名其项目模板。