Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange UIAlertView private method crash _performPopup

I'm trying to figure out crash caused by a private method in UIAlertView. About half of my app crashes involve this.

-[UIAlertView(Private) _performPopup:animationType:revealedBySpringBoardAlert:]

Here's the section from my crash report. What bothers me is that most of my alert views are popped by singleton objects that are designed to exist throughout the app life cycle. So I'm not sure if this is caused by UIAlertView's delegate getting released before it is called by it. Has anyone seen this before? Can you please advise? Thanks.

Hardware Model:      iPhone4,1
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-11-15 11:31:57.452 -0800
OS Version:      iOS 6.0.1 (10A523)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x5354440a
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x33ab95b6 objc_msgSend + 22
1   UIKit                           0x32e52fa0 -[UIAlertView(Private) _performPopup:animationType:revealedBySpringBoardAlert:]
2   UIKit                           0x330621c4 -[UIAlertView(Private) _repopupNoAnimation]
3   UIKit                           0x33065b38 __36-[_UIAlertStackWatcher _appResumed:]_block_invoke_0
4   libdispatch.dylib               0x37ec211c _dispatch_call_block_and_release
5   libdispatch.dylib               0x37ec14b4 _dispatch_client_callout
6   libdispatch.dylib               0x37ec61b8 _dispatch_main_queue_callback_4CF$VARIANT$mp
7   CoreFoundation                  0x39ba2f36 __CFRunLoopRun
8   CoreFoundation                  0x39b15eb8 CFRunLoopRunSpecific
9   CoreFoundation                  0x39b15d44 CFRunLoopRunInMode
10  GraphicsServices                0x37ee32e6 GSEventRunModal
11  UIKit                           0x32d552f4 UIApplicationMain
12  MYAPP                           0x0000334a main + 70
13  MYAPP                           0x000032fc start + 36
like image 961
George Burdell Avatar asked Nov 28 '12 09:11

George Burdell


1 Answers

It sounds like the delegate is causing the problem here. For simple UIAlertViews that don't need to track the user input, you can just set the delegate to nil, such as:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My Alert" message: @"My Message" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];

If you do need the delegate methods, just make sure you nil the UIAlertView's delegate when losing the view:

alert.delegate = nil;

Either in dealloc or possibly viewWillDisappear: depending on how your code is set up!

like image 101
a1phanumeric Avatar answered Nov 15 '22 05:11

a1phanumeric