[TIMOB-17660] iOS8: OptionDialog doesn't work in a Popover
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-10-02T20:33:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.2, Release 3.5.0, Release 4.0.0 |
Components | iOS |
Labels | Ti.UI.OptionDialog, Ti.UI.iPad.Popover, iOS8, iPad, kitchensink, module_popover, qe-manualtest |
Reporter | Fokke Zandbergen |
Assignee | Vishal Duggal |
Created | 2014-09-09T13:49:11.000+0000 |
Updated | 2014-11-21T20:00:27.000+0000 |
Description
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*
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();
*Crash*
[DEBUG] 2014-09-09 15:39:42.671 od[17557:1974892] Presenting view controllers on detached view controllers is discouraged <UIViewController: 0x79f69cf0>.
[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
The result of the above test case has changed with iOS 8 GM as a result of a fix by Apple documented in the [release notes](https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.0/index.html#//apple_ref/doc/uid/TP40014223) as: > To use an action sheet-style UIAlertController on iPad, the sourceView of the alert controller's popoverPresentationController must be set. The result of the test case is now: 1. With
view
it now works 2. Withoutview
it is unchanged Reading the above comment by Apple I guess we need to update the documentation and add a warning thatview
is now required for iPad, but *only* if it is used in a popover since TIMOB-17639 now *does* work withoutview
.Need to rewrite related proxies. Waiting for ticket from [~vduggal]. Likely to go into 3.4.1.
Resolved as part of TIMOB-17804
Closing as fixed per [~jalter]comment. Tested the above code and verified optionDialog does work in a Popover. Environment used Mac osx 10.9.5 Mavericks Appcelerator Studio, build: 3.4.0.201409261245 Titanium SDK, build: 3.4.1.v20141002135200 acs@1.0.18 alloy 1.5.1 install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium 3.4.0 titanium-code-processor@1.1.1 Xcode6.1GM Device: iPad mini iOS 8.1 iPad mini iOS 7.0.3