Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27861] iOS: openURL() callback not invoked if missing options dictionary as of 8.1.0

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-05-06T11:54:24.000+0000
Affected Version/sRelease 8.1.0
Fix Version/sRelease 9.0.2
ComponentsiOS
Labelscallback, ios, openUrl, regression
ReporterJoshua Quick
AssigneeVijay Singh
Created2020-04-21T23:59:20.000+0000
Updated2020-05-06T11:54:24.000+0000

Description

*Summary:* The 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);
});

Comments

  1. Vijay Singh 2020-04-22

    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.
  2. Samir Mohammed 2020-05-05

    FR Passed on Master and 9_0_X, waiting on Jenkins build.
  3. Christopher Williams 2020-05-05

    merged to master for 9.1.0 target and 9_0_X for 9.0.2 target
  4. Samir Mohammed 2020-05-06

    *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

JSON Source