Xcode,Objective-C和Cocoa之间有什么区别? [英] What’s the difference between Xcode, Objective-C and Cocoa?

查看:191
本文介绍了Xcode,Objective-C和Cocoa之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题在这里经常出现,即使只是当用户误认他们的iOS问题时。因此,Xcode,Objective-C和Cocoa有什么区别?

This question pops up quite often here, even if just implicitly when users mistag their iOS questions. So, what’s the difference between Xcode, Objective-C and Cocoa?

推荐答案

Objective-C是一种编程语言。可以说,它只是一个描述什么有效的Objective-C程序看起来和它们的意思。如果你有一个用Objective-C编写的源代码列表,你需要一个解释器或编译器来使列表工作。像Objective-C这样的语言通常是经过编译的,因此大多数人都使用编译器(如 LLVM )。 Objective-C几乎专门用于开发iOS和OS X,但也有其他用途,例如,有些人为Linux编写了Objective-C。

Objective-C is a programming language. It could be said that it’s just a description of what valid Objective-C programs look like and what they mean. If you have a source code listing written in Objective-C, you need an interpreter or a compiler to put the listing to work. Languages like Objective-C are usually compiled, so most people use a compiler (like LLVM). Objective-C is almost exclusively used to develop for iOS and OS X, but there are other uses, too – as an example, some people write Objective-C for Linux.

您可以使用文本编辑器编写源代码和编译器,将它们转换为实际的程序,但是使用现代技术还有很多需要注意的地方,因此还有另一个程序可以使您的工作更轻松。这些被称为集成开发环境或IDE。 IDE为您提供了一种方便的方法来编辑源代码,编译它们,调试生成的程序,阅读文档和许多其他事情。 Xcode是一个这样的IDE。一个重要的观察是,Xcode不会自己编译源代码,它只是调用独立编译器(LLVM)。 Xcode不是您可以用来开发Objective-C应用程序的唯一IDE,例如, AppCode

You can use a text editor to write the sources and a compiler to turn them into an actual programs, but with modern technologies there’s much more to take care of, so that there is another program to make your job easier. These are called Integrated Development Environments, or IDEs. An IDE offers you a convenient way to edit the sources, compile them, debug the resulting programs, read the documentation, and many other things. Xcode is one such IDE. An important observation here is that Xcode does not compile your sources itself, it just calls the standalone compiler (LLVM). And Xcode is not the only IDE you can use to develop Objective-C apps – there’s AppCode, for example.

每次从头开始编写iOS或OS X应用程序将非常耗时。这就是为什么苹果为开发人员提供了一套好的图书馆。这些库只是苹果编写的大量源代码,而且这个源代码负责应用程序共有的大部分内容。这些库被称为Cocoa。

Writing iOS or OS X apps from scratch each time would be very time-consuming. That’s why Apple provides the developers with a good set of libraries. The libraries are simply a huge amount of source code written by Apple, and this source code takes care of most things that apps have in common. These libraries are called Cocoa.

现在,如果你不知道如何扩展一个类,你最有可能是在谈论Objective-C。它与Xcode或Cocoa没有任何关系,你可以很好地使用Vim作为IDE编写一些 GNUstep 代码和GCC作为编译器。另一方面,如果你的Xcode构建过程失败,因为一些神秘的设置,或者如果你想在Xcode中构建一个静态库,这显然是一个Xcode问题。如果你不知道如何使用一些NSObject工具或NSFileManager类,那就是Cocoa。 (但它不必是Xcode相关的,因为你可以使用AppCode或TextMate作为你的IDE!)

Now, if you can’t figure out how to extend a class, you are most probably talking about Objective-C. It doesn’t have anything to do with Xcode or Cocoa, you could be very well writing some GNUstep code for Linux using Vim as an IDE and GCC as a compiler. On the other hand, if your Xcode build process fails because of some mysterious setting, or if you’re trying to build a static library in Xcode, that’s clearly an Xcode issue. And if you can’t figure out how to use some NSObject facility or the NSFileManager class, that’s Cocoa. (But it doesn’t have to be Xcode-related, as you could use AppCode or TextMate as your IDE!)

本来可在我的博客。如果重新标记或解释差异,请随意链接到博文或此问题。

Originally available on my blog. Feel free to link to the blog post or this question when retagging or explaining the difference.

这篇关于Xcode,Objective-C和Cocoa之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆