比较糊涂的autorelease
来源:互联网 发布:游戏特效软件 编辑:程序博客网 时间:2024/05/16 08:58
在学习iphone定位api的时候,由于偷懒,在方法调用的时候 省略了self,如下:
- (void)viewDidLoad {
[super viewDidLoad];
clManager = [[[CLLocationManager alloc] init] autorelease];//如果改成self.clManager = [[[CLLocationManager alloc] init] //autorelease];则没有问题
clManager.delegate = self;
[clManager startUpdatingLocation];
}
因为调用了autorelease,而clManager没有加self前缀,导致[clManager startUpdatingLocation];调用无法激活代理函数的调用(- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation)
解决方案,要么去掉autorelease,要么增加self。
- 比较糊涂的autorelease
- 糊涂的爱情,糊涂爱
- 糊涂的一天
- CListBox的糊涂使用
- 程序员的糊涂爱情
- 糊涂的ATM
- CListBox的糊涂使用
- 糊涂的程序员
- 糊涂的教授
- SSL2654 糊涂的教授
- 糊涂
- 糊涂
- 情感的问题,越想越糊涂
- 我糊涂的进来了
- 传统微分的糊涂定义
- 感觉最近比较糊涂,看了篇自己觉得好的总结,先转下贴,自己再慢慢总结吧
- autorelease对象的释放
- 不稳定的autorelease
- office2007安装一半出错的解决办法
- Makefile 详解 (书写规则)
- ava.Swing.GroupLayout cannot be resolved.解决办法
- STM32之用SysTick做准确定时
- Android-NDK开发之第三个例子--传递字符串数组和中文乱码问题
- 比较糊涂的autorelease
- sqlserver唯一权限
- 教程:打造自己的一个个性QQ邮箱
- Makefile详解 书写命令
- linux多线程设计
- Tomcat 与 Java 的环境变量配置
- using try catch finally in SQL
- 设置Global Breakpoint定位错误代码所在位置
- DIV+CSS 网站标准