ARC forbid explicit message send of 'release'

来源:互联网 发布:手机怎么注销淘宝账号 编辑:程序博客网 时间:2024/06/08 19:08

ARC forbid explicit message send of ‘release’

ARC 其实是5.0之后加入的新特性,AutoRelease Reference Counting

#import <UIKit/UIKit.h>#import "AppDelegate.h"int main(int argc, char * argv[]) {    @autoreleasepool {        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));    }}

这个可以在Build Settings一栏里面的Apple LLVM 6.0 -Languages - Objective C里面的Automatic Reference Counting里面YES改为NO

简单的影响就是你每一个alloc都要自己手动release。但是似乎在视频音频这里,最好还是要自己手动release以免造成内存泄漏。

这个问题对我这个新手来说主要是参考旧代码的时候(旧代码都会有相应的release dealloc derain什么的,会报错,因为ARC已经自己支持计数,这个是Objective - C的新特性。)

如果有错欢迎评论交流。

0 0