Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14966] iOS: "Open In" doesn't catch source App when App is already launched (resuming)

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterAntonio Vila
AssigneeUnknown
Created2013-08-26T09:53:56.000+0000
Updated2018-02-28T20:03:59.000+0000

Description

Current code only gets URL and "handleOpenURL" is obsolete:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
	[launchOptions removeObjectForKey:UIApplicationLaunchOptionsURLKey];	
	[launchOptions setObject:[url absoluteString] forKey:@"url"];
	return YES;
}
openURL will do the work!
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
	[launchOptions removeObjectForKey:UIApplicationLaunchOptionsURLKey];
	[launchOptions setObject:[url absoluteString] forKey:@"url"];
    
	[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];
	[launchOptions setObject:sourceApplication forKey:@"source"];
    
	return YES;
}

Comments

  1. Daniel Sefton 2013-08-27

    Hi Antonio, Please can you provide a JavaScript test case that we can drop into an app.js and run? Also, some steps to reproduce would be helpful (for example, I'm not sure off the top of my head where you would access the "Open In" option) Thanks!
  2. Antonio Vila 2013-08-28

    It is quite simple: var queryString = Ti.App.getArguments().url; var sourceApp = Ti.App.getArguments().source; Ti.Api.info(sourceApp); Regardless of the previous sample, the recommended way to obtain source and URL is openUrl (https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:openURL:sourceApplication:annotation:). handleOpenURL is deprecated.

JSON Source