Objective-C中静态consts的内存管理

时间:2016-04-26 20:17:24

标签: ios objective-c facebook memory-management unsafe-unretained

当我在7:01注意到一个有趣的代码部分时,我正在观看F8-2016 Building iOS Tooling at Facebook Scale视频。

Facebook以这种方式在Objective-C中定义了一个静态常量:

static __unsafe_unretained NSString * const kAuthorKey = @"AUTHOR";

到目前为止,我以相同的方式声明了我的静态常量,但没有__unsafe_unretained。如果没有此修饰符,常量将为strong,但由于它始终在应用程序运行期间存在,因此无论是strong还是__unsafe_unretained都无关紧要。

我错过了什么吗? Facebook有任何理由使用__unsafe_unretained吗?

0 个答案:

没有答案