- 代码中不能使用retain, release, retain, autorelease
- 不重载dealloc(如果是释放对象内存以外的处理,是可以重载该函数的,但是不能调用[super dealloc])
- 不能使用NSAllocateObject, NSDeallocateObject
- 不能在C结构体中使用对象指针
- id与void *间的如果cast时需要用特定的方法(__bridge关键字)
- 不能使用NSAutoReleasePool、而需要@autoreleasepool块
- 不能使用“new”开始的属性名称 (如果使用会有下面的编译错误”Property’s synthesized getter follows Cocoa naming convention for returning ‘owned’ objects”)
----
ARC之@property
属性值 | 关键字 | 所有权 |
strong | __strong | 有 |
weak | __weak | 无 |
unsafe_unretained | __unsafe_unretained | 无 |
copy | __strong | 有 |
assign | __unsafe_unretained | 无 |
retain | __strong | 有 |
1,weak:delegate和IBOutlet用该属性来声明
2,assign:一般数据变量,BOOL
3,unsafe_unretained等价weak。
4,readwrite和readonly-----需要类似@property (nonatomic, strong, readonly) NSString *name;