【发布时间】:2010-12-07 09:25:34
【问题描述】:
我正在使用 NSThread 与主线程同时做一些工作。我已经在 iPhone 3G 上部署了应用程序 应用程序在首次运行时按预期运行。
但是,当我关闭应用程序并再次运行它时,它会立即崩溃。下次我运行该应用程序时,它又可以正常工作了。这不断重复。
我不知道为什么应用程序的早期运行会对下次运行产生影响。 请帮忙!
这是我的代码:
NSThread *th=[[NSThread alloc]initWithTarget:self selector:@selector(loadMap) object:nil];
[th start];
-(void) loadMap{
NSAutoreleasePool * pool=[[NSAutoreleasePool alloc]init];
//code to load MKMapView
[pool release];
}
提前致谢
如果我在两次运行之间打开另一个地图应用程序,应用程序不会崩溃! 如果我删除线程并串行加载地图,应用程序也可以正常工作
【问题讨论】:
标签: iphone crash mkmapview nsthread