[TIMOB-27354] iOS13 - Ti.App.getArguments().url undefined when resuming
| GitHub Issue | n/a |
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2019-10-09T13:54:09.000+0000 |
| Affected Version/s | Release 8.1.0 |
| Fix Version/s | Release 8.2.1 |
| Components | iOS |
| Labels | engSchedule, ios |
| Reporter | Joren Vos |
| Assignee | Vijay Singh |
| Created | 2019-08-23T13:25:46.000+0000 |
| Updated | 2019-10-30T02:35:46.000+0000 |
Description
It seems that Ti.App.getArguments().url is undefined when you open an already-opened app using an URL-scheme in iOS 13.
In attachment, there is a sample project that runs as expected on iOS 12 but is broken on iOS 13 beta.
There are two apps, app A and app B. When you open app A and press on the button to open app B, you’ll see the alert containing the URL-scheme that was used to open app B. When you try to go back to app A using URL-scheme, after resuming in app A the Ti.App.getArguments().url returns the URL-scheme that was used to open app A in iOS 12. In iOS 13, navigating from app B to app A will return undefined for Ti.App.getArguments().url
Attachments
[~cwilliams] FYI
tl;dr: The SDK needs to properly guard the "source" parameter before returning improper values, but most cases are not affected by that. We see a related issue where our Swift extension crashes because the
openURL:delegate method returns improper values to the underlaying API's, causing these issues. It can also be seen in a crash when logging in with Ti.Facebook where the app crashes because thesourceApplicationparam of the bubbled delegate method isnil. *EDIT*: Thesourceis also undefined with iOS 13, which is native behavior: https://forums.developer.apple.com/thread/119118 *EDIT 2*: For your issue, you can easily resolve it by using thehandleurlevent inTi.App.iOSwhich is generally more stable thanresumed. [~jvos] This fixes your issue (which is not Titanium related in that case):Our issue is related to Ti.GoogleSignIn, but the actual issue is an SDK issue where the (nil) source is returned as aTi.App.iOS.addEventListener('handleurl', event => { setTimeout(() => { alert(JSON.stringify(event)); }, 1000); }); var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); win.open();NSNulltype, causing some SDK's to handle it improperly, since it's either nil or a string, nut notNSNull, so the SDK should be updated to handle it properly.1. While debugging I found that - Sequence of calling following delegate methods has changed - Function1 - [-(void)applicationWillEnterForeground:(UIApplication *)application](https://github.com/appcelerator/titanium_mobile/blob/c6978221163cb9a628859b39042fa697b6065471/iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m#L1086) Function2 - [- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary
PR (master) - https://github.com/appcelerator/titanium_mobile/pull/11242 PR (8_2_X) - https://github.com/appcelerator/titanium_mobile/pull/11243
FR Failed - Information in PR (8_2_X)
FR Failed (PR Master) Information in PR: https://github.com/appcelerator/titanium_mobile/pull/11242#issuecomment-537533063
Changes that have been made alleviate the bug. FR Passed.
merged to master and 8_2_X
Verified using builds: 8.2.1.v20191008121020 8.3.0.v20191008081818 Ticket closed.
For me is undefined with 8.2.1.v20191010112656
Undefined also with 8.2.1, with iOS 13.1.3
@Xavier Alfeiran I solved using handle url event:
Ti.App.iOS.addEventListener("handleurl", function() { if (!_.isUndefined(Ti.App.getArguments().url)) { Ti.API.info("RESUME URLSCHEME: " + Ti.App.getArguments().url); var url = Ti.App.getArguments().url; var ods = url.substring(("scheme://").length, url.length); if (!Alloy.Globals.itinerarioAperto) { getODS(ods); } } });it worked nice, thank you