2012-11-28 1 views
8

UIAlertView에서 개인 메서드로 인해 발생하는 크래시를 파악하려고합니다. 내 응용 프로그램 충돌의 절반 정도가이 문제와 관련이 있습니다.이상한 UIAlertView 개인 메서드 충돌 _performPopup

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

여기 내 사고 보고서의 섹션이 있습니다. 나를 귀찮게하는 것은 앱 라이프 사이클 전반에 걸쳐 존재하도록 설계된 싱글 톤 객체가 내 경보 뷰의 대부분을 튕겨내는 것입니다. 그래서 이것이 UIAlertView의 delegate에 의해 호출되기 전에 해제되는 것이 원인인지 확실하지 않습니다. 이걸 본 사람 있어요? 좀 도와 줄 수있어? 감사.

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 
+0

유는 참조 포스트 alertview –

+1

을 만들기위한 코드를 공유 할 수

는 상기의 viewDidLoad 메소드에 다음을 추가 stackoverflow.com/questions/2581081/uialertview-crashing-on-undocumented-method – petert

답변

3

여기에서 대리인이 문제를 일으키는 것 같습니다. 사용자 입력을 추적 할 필요가없는 간단한 UIAlertViews를 들어, 당신은 단지 같은 무기 호에 대리자를 설정할 수 있습니다

당신은 단지 당신이 UIAlertView의 위임 경우를 nil을 확인, 위임 방법을 필요로 할 경우
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My Alert" message: @"My Message" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
[alert show]; 

보기를 잃고 :

alert.delegate = nil; 

viewWillDisappear 할당 해제 또는 아마도 다음 중 하나를 코드 설정 방법에 따라!

0

앱이 백그라운드로 이동하면 알림보기를 닫고 무시하는 것도 좋은 생각입니다.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleApplicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; 

이 handleApplicationDidEnterBackground의 구현은 다음과 같아야합니다 : HTTP : //

- (void)handleApplicationDidEnterBackground:(NSNotification *)n 
{ 
    if (self.alertView) 
    { 
     self.alertView.delegate = nil; 
     [self.alertView dismissWithClickedButtonIndex:[self.alertView cancelButtonIndex] animated:NO]; 
     self.alertView = nil; 
    } 
}