我的应用突然崩溃了。我得到了以下
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000010f8b9f0
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01223a63 objc_msgSend + 23
1 CoreFoundation 0x00fd8a6c CFRelease + 92
2 CoreFoundation 0x010ba8ca -[__NSArrayI dealloc] + 170
3 CoreFoundation 0x00fd8a6c CFRelease + 92
4 CoreFoundation 0x00ffdb8d _CFAutoreleasePoolPop + 237
5 Foundation 0x00056738 -[NSAutoreleasePool drain] + 167
6 CFNetwork 0x0168c606 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 220
7 CFNetwork 0x01757821 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 293
8 CFNetwork 0x01757b0f URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 1043
9 CFNetwork 0x01682e3c URLConnectionClient::processEvents() + 100
10 CFNetwork 0x01682cb7 MultiplexerSource::perform() + 251
11 CoreFoundation 0x010a301f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x0100128b __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x01000786 __CFRunLoopRun + 470
14 CoreFoundation 0x01000240 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x01000161 CFRunLoopRunInMode + 97
16 GraphicsServices 0x0198d268 GSEventRunModal + 217
17 GraphicsServices 0x0198d32d GSEventRun + 115
18 UIKit 0x0030c42e UIApplicationMain + 1160
19 i-Referral 0x00002582 main + 84 (main.m:53)
20 i-Referral 0x00002525 start + 53
如果我在Zombie开启的情况下运行“Allocations”,一切正常,但没有举起旗帜。
在NSURLRequest坐在App委托中后崩溃了。有什么想法吗?
在connectionDidFinishLoading:方法中,我只调用解析。创建并释放一个数组。
当应用程序崩溃时,它没有那么远。
当应用程序首次在此处启动事件序列时: 设置nsurl, 康纳收到回复, conn收到的数据, 连接完成加载, 解析开始...
当崩溃发生时,我调用app delegate中的一个方法 设置nsurl, 然后崩溃从未达到conn收到的响应
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSXMLParser *responseParser = [[NSXMLParser alloc] initWithData:provListData];
responseParser.delegate = self;
[responseParser parse];
[responseParser release];
}
我认为推动新控制器导致崩溃。
这就是我所拥有的。登录视图 - &gt;注册视图
如果注册完成新页面,将显示仪表板。它将通过成为根视图控制器来替换登录和注册页面。
我有这个工作,但某些地方发生了变化。
我在成功登录时做同样的事情,并且工作正常。
初始化
UINavigationController *localNavigationController;
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
ProviderListViewController *firstViewController;
firstViewController = [[ProviderListViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc]
initWithRootViewController:firstViewController];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[firstViewController release];
Login *signupViewController;
signupViewController = [[Login alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc]
initWithRootViewController:signupViewController];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[signupViewController release];
SecondViewController *secondViewController;
secondViewController = [[SecondViewController alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc]
initWithRootViewController:secondViewController];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[secondViewController release];
tabBarController.viewControllers = localControllersArray;
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
[localControllersArray release];
推新控制器
AppDelegate *appd = [[AppDelegate alloc]init];
[appd gotConnection];
[appd release];
UINavigationController *navcont = self.navigationController;
[self retain];
Dashboard *third = [[Dashboard alloc] initWithNibName:@"Dashboard" bundle:nil];
NSArray *newarray = [NSArray arrayWithObjects:third,nil,nil];
[navcont setViewControllers:newarray animated:YES];
[third release];
答案 0 :(得分:1)
看起来您正在release
方法向已解除分配的实例发送connectionDidFinishLoading:
消息。检查内存管理调用是否正在平衡。
答案 1 :(得分:0)
尝试删除推送新控制器的最后一个代码的[third release];
然后离开那里并尝试删除[localControllersArray release];
答案 2 :(得分:0)
我已经专门用了一个周末来阻止泄漏并确保所有保留/初始化/释放都能解决。崩溃终于消失了,但从未真正改变崩溃报告引用的类。