Project: titanium
Issue TIMOB-17660: iOS8: OptionDialog doesn't work in a Popover
This issue is probably related somehow to TIMOB-17639. *Problem* If you want to show an {{Ti.UI.OptionDialog}} in a {{Ti.UI.iPad.Popover}} it won't show - or even crash if you pass a {{view}} property. *Reproducing* Build and run the test case on the next 2 configurations to see it crash. * iOS 7.1 using 3.3.0.GA: Works * iOS 8.0 using 3.4.0-beta: *Fails* Uncomment line 31 and repeat to see it fail without crash. *Test case* {code} var win = Ti.UI.createWindow({ backgroundColor: 'white' }); var btn = Ti.UI.createButton({ title: 'Click me' }); btn.addEventListener('click', function(e) { var popWin = Ti.UI.createWindow({ backgroundColor: 'white' }); var popBtn = Ti.UI.createButton({ title: 'Click me' }); popWin.add(popBtn); var pop = Ti.UI.iPad.createPopover({ width: 320, height: 320, contentView: popWin }); popBtn.addEventListener('click', function(e) { Ti.UI.createOptionDialog({ options: ['a', 'b'] }).show({ view: popBtn // also try without to fail without crash }); }); pop.show({ view: btn }); }); win.add(btn); win.open(); {code} *Crash* {code} [DEBUG] 2014-09-09 15:39:42.671 od[17557:1974892] Presenting view controllers on detached view controllers is discouraged . [ERROR] The application has crashed with an uncaught exception 'NSGenericException'. [ERROR] Reason: [ERROR] UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x79f6cfc0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs. [ERROR] Stack trace: [ERROR] [ERROR] 0 CoreFoundation 0x04bb4dda __exceptionPreprocess + 154 [ERROR] 1 libobjc.A.dylib 0x0478e837 objc_exception_throw + 44 [ERROR] 2 CoreFoundation 0x04bb4d1d +[NSException raise:format:] + 141 [ERROR] 3 UIKit 0x01cc87f1 -[UIPopoverPresentationController presentationTransitionWillBegin] + 388 [ERROR] 4 UIKit 0x015d9f25 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1666 [ERROR] 5 UIKit 0x015d8528 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 226 [ERROR] 6 UIKit 0x0160b7ab __40+[UIViewController _scheduleTransition:]_block_invoke + 18 [ERROR] 7 UIKit 0x014d2aee ___afterCACommitHandler_block_invoke + 15 [ERROR] 8 UIKit 0x014d2a99 _applyBlockToCFArrayCopiedToStack + 415 [ERROR] 9 UIKit 0x014d28ae _afterCACommitHandler + 545 [ERROR] 10 CoreFoundation 0x04ad7fbe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 [ERROR] 11 CoreFoundation 0x04ad7f00 __CFRunLoopDoObservers + 400 [ERROR] 12 CoreFoundation 0x04acd93a __CFRunLoopRun + 1226 [ERROR] 13 CoreFoundation 0x04acd1ab CFRunLoopRunSpecific + 443 [ERROR] 14 CoreFoundation 0x04accfdb CFRunLoopRunInMode + 123 [ERROR] 15 GraphicsServices 0x0519924f GSEventRunModal + 192 [ERROR] 16 GraphicsServices 0x0519908c GSEventRun + 104 [ERROR] 17 UIKit 0x014a9386 UIApplicationMain + 1526 [ERROR] 18 od 0x00061828 main + 456 [ERROR] 19 libdyld.dylib 0x05484ac9 start + 1 [ERROR] [ERROR] 2014-09-09 15:39:42.696 od[17557:1974892] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x79f6cfc0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.' [ERROR] *** First throw call stack: [ERROR] ( [ERROR] 0 CoreFoundation 0x04bb4df6 __exceptionPreprocess + 182 [ERROR] 1 libobjc.A.dylib 0x0478e837 objc_exception_throw + 44 [ERROR] 2 CoreFoundation 0x04bb4d1d +[NSException raise:format:] + 141 [ERROR] 3 UIKit 0x01cc87f1 -[UIPopoverPresentationController presentationTransitionWillBegin] + 388 [ERROR] 4 UIKit 0x015d9f25 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1666 [ERROR] 5 UIKit 0x015d8528 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 226 [ERROR] 6 UIKit 0x0160b7ab __40+[UIViewController _scheduleTransition:]_block_invoke + 18 [ERROR] 7 UIKit 0x014d2aee ___afterCACommitHandler_block_invoke + 15 [ERROR] 8 UIKit 0x014d2a99 _applyBlockToCFArrayCopiedToStack + 415 [ERROR] 9 UIKit 0x014d28ae _afterCACommitHandler + 545 [ERROR] 10 CoreFoundation 0x04ad7fbe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 [ERROR] 11 CoreFoundation 0x04ad7f00 __CFRunLoopDoObservers + 400 [ERROR] 12 CoreFoundation 0x04acd93a __CFRunLoopRun + 1226 [ERROR] 13 CoreFoundation 0x04acd1ab CFRunLoopRunSpecific + 443 [ERROR] 14 CoreFoundation 0x04accfdb CFRunLoopRunInMode + 123 [ERROR] 15 GraphicsServices 0x0519924f GSEventRunModal + 192 [ERROR] 16 GraphicsServices 0x0519908c GSEventRun + 104 [ERROR] 17 UIKit 0x014a9386 UIApplicationMain + 1526 [ERROR] 18 od 0x00061828 main + 456 [ERROR] 19 libdyld.dylib 0x05484ac9 start + 1 [ERROR] ) [ERROR] libc++abi.dylib: terminating with uncaught exception of type NSException {code}
Story points: 3