のサブクラスを作成しました。アプリで、そこからUIView
を提示する必要があります。UIViewController
私は次のことを試しました:
poiInfoController = [[poiInfoController alloc]initWithNibName:@"poiInfoController" bundle:nil];
[poiInfoController setModalPresentationStyle:UIModalPresentationFormSheet];
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentModalViewController:poiInfoController animated:YES];
しかし、キャッチされない例外 'NSInvalidArgumentException'、理由: 'アプリケーションがアクティブなコントローラーをモーダルに提示しようとした' ため、終了中のアプリでクラッシュします。
助けてください、
**EDIT CRASH LOG:**
2014-04-23 17:04:26.433 NavigationLibSprintMoM[4610:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <ViewController: 0x9d52140>.'
*** First throw call stack:
(
0 CoreFoundation 0x017c15e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014d08b6 objc_exception_throw + 44
2 UIKit 0x0036217a -[UIViewController presentViewController:withTransition:completion:] + 4879
3 UIKit 0x00362caf -[UIViewController presentViewController:animated:completion:] + 130
4 NavigationLibSprintMoM 0x00005f7b -[NavigationView handleGesture:] + 964
5 UIKit 0x005baf8c _UIGestureRecognizerSendActions + 230
6 UIKit 0x005b9c00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
7 UIKit 0x005bb66d -[UIGestureRecognizer _delayedUpdateGesture] + 60
8 UIKit 0x005bebcd ___UIGestureRecognizerUpdate_block_invoke + 57
9 UIKit 0x005beb4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
10 UIKit 0x005b5248 _UIGestureRecognizerUpdate + 199
11 UIKit 0x00281d4a -[UIWindow _sendGesturesForEvent:] + 1291
12 UIKit 0x00282c6a -[UIWindow sendEvent:] + 1030
13 UIKit 0x00256a36 -[UIApplication sendEvent:] + 242
14 UIKit 0x00240d9f _UIApplicationHandleEventQueue + 11421
15 CoreFoundation 0x0174a8af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x0174a23b __CFRunLoopDoSources0 + 235
17 CoreFoundation 0x0176730e __CFRunLoopRun + 910
18 CoreFoundation 0x01766b33 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x0176694b CFRunLoopRunInMode + 123
20 GraphicsServices 0x038699d7 GSEventRunModal + 192
21 GraphicsServices 0x038697fe GSEventRun + 104
22 UIKit 0x0024394b UIApplicationMain + 1225
23 NavigationLibSprintMoM 0x0000374d main + 141
24 libdyld.dylib 0x01f54725 start + 0
25 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException