我使用微調圖形創建了一個警告對話框。分配和解除UIAlert w /微調器動畫:有時崩潰,做錯了?
UIAlertView *alert; //(at top of controller)
alert = [[[UIAlertView alloc] initWithTitle:@"Looking for someone to connnect to via WiFi" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[alert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.center = CGPointMake(alert.bounds.size.width/2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
[indicator release];
然後它以後駁回這樣的:
[alert dismissWithClickedButtonIndex:0 animated:YES];
這偶爾會導致崩潰:
Sun Mar 7 12:01:29 unknown com.apple.SpringBoard[24] <Notice>: CoreAnimation: timed out fence 500
Sun Mar 7 12:01:29 unknown ReportCrash[1615] <Notice>: Formulating crash report for process someApp[1614]
和跟蹤:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x00090b2c __kill + 8
1 libSystem.B.dylib 0x00090b1a kill + 4
2 libSystem.B.dylib 0x00090b0e raise + 10
3 libSystem.B.dylib 0x000a7e34 abort + 36
4 libstdc++.6.dylib 0x00066390 __gnu_cxx::__verbose_terminate_handler() + 588
5 libobjc.A.dylib 0x00008898 _objc_terminate + 160
6 libstdc++.6.dylib 0x00063a84 __cxxabiv1::__terminate(void (*)()) + 76
7 libstdc++.6.dylib 0x00063afc std::terminate() + 16
8 libstdc++.6.dylib 0x00063c24 __cxa_throw + 100
9 libobjc.A.dylib 0x00006e54 objc_exception_throw + 104
10 CoreFoundation 0x00026b2c +[NSException raise:format:arguments:] + 76
11 CoreFoundation 0x00026acc +[NSException raise:format:] + 24
12 GameKit 0x00025a50 -[GKPeerPickerViewController _shouldShowConnectTypeView] + 124
13 GameKit 0x00026200 -[GKPeerPickerViewController loadInitialView] + 76
14 GameKit 0x000262a4 -[GKPeerPickerViewController loadView] + 108
15 UIKit 0x00069750 -[UIViewController view] + 44
16 GameKit 0x000263fc -[GKPeerPickerViewController show] + 204
17 GameKit 0x00023fbc -[GKPeerPickerController show] + 80
18 someApp 0x00002a0c -[someAppViewController btnConnect:] (someAppViewController.m:43)
19 CoreFoundation 0x00059888 -[NSObject performSelector:withObject:withObject:] + 20
20 UIKit 0x0005b77c -[UIApplication sendAction:to:from:forEvent:] + 128
21 UIKit 0x0005b6e4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
22 UIKit 0x0005b6ac -[UIControl sendAction:to:forEvent:] + 44
23 UIKit 0x0005b304 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 528
24 UIKit 0x0005bf84 -[UIControl touchesEnded:withEvent:] + 452
25 UIKit 0x0005a8f8 -[UIWindow _sendTouchesForEvent:] + 520
26 UIKit 0x00059f8c -[UIWindow sendEvent:] + 108
27 UIKit 0x00055788 -[UIApplication sendEvent:] + 400
28 UIKit 0x0005508c _UIApplicationHandleEvent + 4528
29 GraphicsServices 0x000057dc PurpleEventCallback + 1044
30 CoreFoundation 0x00057524 CFRunLoopRunSpecific + 2296
31 CoreFoundation 0x00056c18 CFRunLoopRunInMode + 44
32 GraphicsServices 0x000041c0 GSEventRunModal + 188
33 UIKit 0x00003c28 -[UIApplication _run] + 552
34 UIKit 0x00002228 UIApplicationMain + 960
35 someApp 0x0000266e main (main.m:14)
36 someApp 0x00002604 start + 44
一件事這很引人注目是引用從GameKit轉到GKPeerPicker;我沒有在任何地方使用它(我使用GameKit的GKSession,但我沒有使用GKPeerPicker組件)。
看起來這是問題,rpetrich - 謝謝! 爲了安全起見,我切換到了一個空字符串,Pindatjuh--謝謝你。 – 2010-03-07 22:25:05
我發現了另一個問題:在分配UIAlertView後,快速添加微調器有時會導致警報邊界在CGPointMake中讀爲「0,0」。這使得調整器出現在錯誤的地方(在警報窗口的上方和左側)。 我只是設置了一個計時器到0.2並且調用它,所以在創建UIAlertView之後,微調器就會被添加一小會兒。這感覺有點草率...可能有一個事件我應該使用。 – 2010-03-08 17:27:30
邁克爾F,我堅持面臨同樣的問題。你有沒有找到更好的解決方案?如果不是,你能幫我解釋一下你如何使用NSTimer類來解決問題嗎?我嘗試過,但它並沒有解決問題,我想知道如果我正在使用計時器...如果需要,我可以打開一個新的問題線程,但我認爲這個主題太靠近這個來證明打開一個新的線。 非常感謝! – rdurand 2012-07-06 12:28:30