2012-11-28 13 views
8

मैं UIAlertView में एक निजी विधि के कारण क्रैश को समझने की कोशिश कर रहा हूं। मेरे ऐप क्रैश के लगभग आधा इसमें शामिल हैं।अजीब UIAlertView निजी विधि क्रैश _performPopup

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

यहां मेरी क्रैश रिपोर्ट से अनुभाग है। मुझे परेशान करता है कि मेरे अधिकांश सतर्क विचार सिंगलटन ऑब्जेक्ट्स द्वारा पॉप किए जाते हैं जिन्हें पूरे ऐप लाइफ चक्र में मौजूद होने के लिए डिज़ाइन किया गया है। इसलिए मुझे यकीन नहीं है कि अगर यूआईएलर्टव्यू के प्रतिनिधि द्वारा इसे जारी करने से पहले रिलीज़ किया जा रहा है। क्या किसी ने इसे पहले कभी देखा है? क्या आप सलाह दे सकते हैं? धन्यवाद।

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 *alert = [[UIAlertView alloc] initWithTitle:@"My Alert" message: @"My Message" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
[alert show]; 

आप प्रतिनिधि तरीकों की जरूरत है, बस सुनिश्चित करें कि आप UIAlertView के प्रतिनिधि जब शून्य करते भी हैं दृश्य खोना:

alert.delegate = nil; 

या तो डेलोक में या संभवतः देखें WillDisappear: आपका कोड कैसे स्थापित किया जाता है इस पर निर्भर करता है!

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; 
    } 
} 
संबंधित मुद्दे