Xcode5.0+ARC環境でプロパティのsetアクセサのセマンティクス指定子を省略した場合のデフォルト値はstrong
のようですが、int等の非NSObject型の場合もstrong
というのはおかしかということで調べてみました。
Hoe.h
@interface Hoe : NSObject
@property (nonatmic) int intValue;
+ (void)showPropertyAttribute;
@end
Hoe.m
#import "objc/runtime.h"
@implementation Hoe
+ (void)showPropertyAttribute {
unsigned int outCount;
objc_property_t *properties = class_copyPropertyList([self class], &outCount);
for (int i = 0; i < outCount; i++) {
objc_property_t property = properties[i];
fprintf(stdout, "%s\n", property_getAttributes(property));
}
}
@end
結果
Ti,N,V_intValue
というわけで、非NSObject型の場合はデフォルトはstrong
ではなくassign
であることが分かりました。