开发者

debug crash report

开发者 https://www.devze.com 2023-03-13 18:50 出处:网络
All of a sudden my app started to crash. I have been getting the following Exception Type:EXC_BAD_ACCESS (SIGSEGV)

All of a sudden my app started to crash. I have been getting the following

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     开发者_StackOverflow中文版             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

If I run "Allocations" with Zombie turned on everything works fine however no flag has been raised.

It's crashes after an NSURLRequest sitting in the App delegate. Any idea?

In the connectionDidFinishLoading: method I only call the parsing. One array gets created and released.

When the app crashes it not getting that far.

When the app first start up here the sequence of events: set nsurl, conn received response, conn received data, connection finished loading, parse start...

when the crash happens I call a method inside app delegate it goes to set nsurl, and then crashes never reaches conn received response

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{


NSXMLParser *responseParser = [[NSXMLParser alloc] initWithData:provListData];
responseParser.delegate = self;
[responseParser parse];
[responseParser release];



}

I think the crash caused by pushing the new controller.

Here's what I have. login view -> registration view

if registration done a new page Dashboard will be displayed. It will replace the login and registration page by becoming the root view controller.

I had this working but something got changed somewhere.

I do the same thing on successful login and that works fine.

init

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];

push new controller

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];    


It looks like you are sending a release message to a deallocated instance in connectionDidFinishLoading: method. Check whether memory management calls are balancing out.


Try removing the [third release]; of your last code where you push new controller


Then leave that there and try removing [localControllersArray release];


I've dedicated a weekend to haunt down leaks and making sure that all retain / init /release accounted for. The crash finally went away but never actually changed the class referenced i the crash report.

0

精彩评论

暂无评论...
验证码 换一张
取 消