I downloaded the Xcode 4.2 developer preview version and I created a cocoa application. But I found a very weird syntax in the delegate class:
我下载了Xcode 4.2 developer preview版本,并创建了cocoa应用程序。但是我在委托类中发现了一个非常奇怪的语法:
@property (strong) IBOutlet NSWindow *window;
What does this mean? And the compiler can't even compile it.
这是什么意思?编译器甚至不能编译它。
Thanks in advance!
提前谢谢!
2 个解决方案
#1
20
It indicates that this property is a strong relationship—an ownership. It's ARC's version of the retain
keyword in the same context.
它表明这一属性是一种很强的关系——所有权。它是ARC在相同上下文中保留关键字的版本。
And the compiler can't even compile it.
编译器甚至不能编译它。
It's valid ARC code, so if your tools support ARC, they certainly should be able to compile it.
它是有效的ARC代码,所以如果您的工具支持ARC,那么它们当然应该能够编译它。
Make sure that you're using Xcode 4.2 or later, and that you have the project's compiler choice set to Clang (“Apple LLVM Compiler”).
确保您正在使用Xcode 4.2或更高版本,并且项目的编译器选择设置为Clang(“Apple LLVM编译器”)。
#2
3
Strong refers to the automatic reference counting (ARC) that is arriving in the new LLVM compiler, part of Xcode 4.2 when it's released. Presently, Xcode 4.2 preview is still under NDA - post any questions to the developer forums by logging in to your developer account.
Strong指的是在新的LLVM编译器(Xcode 4.2的一部分)中出现的自动引用计数(ARC)。目前,Xcode 4.2 preview仍然在NDA之下——通过登录到您的开发者帐户,向开发者论坛发布任何问题。
See this good weblog post.
看看这篇好文章。
#1
20
It indicates that this property is a strong relationship—an ownership. It's ARC's version of the retain
keyword in the same context.
它表明这一属性是一种很强的关系——所有权。它是ARC在相同上下文中保留关键字的版本。
And the compiler can't even compile it.
编译器甚至不能编译它。
It's valid ARC code, so if your tools support ARC, they certainly should be able to compile it.
它是有效的ARC代码,所以如果您的工具支持ARC,那么它们当然应该能够编译它。
Make sure that you're using Xcode 4.2 or later, and that you have the project's compiler choice set to Clang (“Apple LLVM Compiler”).
确保您正在使用Xcode 4.2或更高版本,并且项目的编译器选择设置为Clang(“Apple LLVM编译器”)。
#2
3
Strong refers to the automatic reference counting (ARC) that is arriving in the new LLVM compiler, part of Xcode 4.2 when it's released. Presently, Xcode 4.2 preview is still under NDA - post any questions to the developer forums by logging in to your developer account.
Strong指的是在新的LLVM编译器(Xcode 4.2的一部分)中出现的自动引用计数(ARC)。目前,Xcode 4.2 preview仍然在NDA之下——通过登录到您的开发者帐户,向开发者论坛发布任何问题。
See this good weblog post.
看看这篇好文章。