[TIMOB-27861] iOS: openURL() callback not invoked if missing options dictionary as of 8.1.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-05-06T11:54:24.000+0000 |
Affected Version/s | Release 8.1.0 |
Fix Version/s | Release 9.0.2 |
Components | iOS |
Labels | callback, ios, openUrl, regression |
Reporter | Joshua Quick |
Assignee | Vijay Singh |
Created | 2020-04-21T23:59:20.000+0000 |
Updated | 2020-05-06T11:54:24.000+0000 |
Description
*Summary:*
The Look in the log. Notice the callback never logged:
Ti.Platform.openURL()
method supports 2 optional arguments, an "options" dictionary and a callback. If you omit the "options" dictionary argument and only supply a callback argument, then the callback will not be invoked. It ignores the callback argument.
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-openURL
This regression was introduced as of Titanium 8.1.0.
The URL will still be opened (if possible), but you cannot receive the result of the open operation to know if it was successful or not in code.
*Test:*
Build and run the below on iOS 10 or higher.
Tap on the "Open URL" button.
Look in the log. Notice the callback never logged: ### openURL() callback...
Note that the URL was still opened, but you can't receive any indication it was successful.
var window = Ti.UI.createWindow();
var button = Ti.UI.createButton({ title: "Async Open URL" });
button.addEventListener("click", function() {
Ti.Platform.openURL("https://www.google.com", function(e) {
Ti.API.info("### openURL() callback event.success: " + e.success);
});
});
window.add(button);
window.open();
*Note:*
Notice the last test case in [TIMOB-23888] tests it without the "options" argument, suggesting that this once worked.
*Work-Around:*
Add the "options" dictionary argument as shown below.
Ti.Platform.openURL("https://www.google.com", {}, function(e) {
Ti.API.info("### openURL() callback event.success: " + e.success);
});
PR(9_0_X) - https://github.com/appcelerator/titanium_mobile/pull/11655 PR(master) - https://github.com/appcelerator/titanium_mobile/pull/11654 @QE Please verify test cases from TIMOB-23888 as well.
FR Passed on Master and 9_0_X, waiting on Jenkins build.
merged to master for 9.1.0 target and 9_0_X for 9.0.2 target
*Closing ticket.* Fix verified in SDK version 9.1.0.v20200505112143 and 9.0.2.v20200505111803 Test and other information can be found at: PR(9_0_X) - https://github.com/appcelerator/titanium_mobile/pull/11655 PR(master) - https://github.com/appcelerator/titanium_mobile/pull/11654