Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDVAppDelegate - missing application:openURL:options implementation #476

Closed
h4ck-rOOt opened this issue Dec 18, 2018 · 1 comment
Closed
Milestone

Comments

@h4ck-rOOt
Copy link

Our company is using a deep linking feature provided by the customurlscheme cordova plugin. In combination with LSSupportsOpeningDocumentsInPlace set to true, an external invocation leads to a crash of the application with NSInternalInconsistencyExecption due to missing implementation of UIApplication -> AppDelegate -> application:openURL:options method.

Our fallback implementation seems to work here, but is obviously incomplete:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    return [self application:app openURL:url sourceApplication:nil annotation:(NSString*)@""];
}

Is there a default implementation which could be used in this use-case or is there something wrong with our handling of in place document editing?

Thanks in advance. I appreciate any advice how to handle this situation.

@dpogue dpogue added this to the 5.0.0 milestone Feb 6, 2019
@dpogue
Copy link
Member

dpogue commented Feb 6, 2019

CordovaLib in cordova-ios 5.0.0 defines an implementation for application:openURL:options :

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
if (!url) {
return NO;
}
NSMutableDictionary * openURLData = [[NSMutableDictionary alloc] init];
[openURLData setValue:url forKey:@"url"];
if (options[UIApplicationOpenURLOptionsSourceApplicationKey]) {
[openURLData setValue:options[UIApplicationOpenURLOptionsSourceApplicationKey] forKey:@"sourceApplication"];
}
if (options[UIApplicationOpenURLOptionsAnnotationKey]) {
[openURLData setValue:options[UIApplicationOpenURLOptionsAnnotationKey] forKey:@"annotation"];
}
// all plugins will get the notification, and their handlers will be called
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLWithAppSourceAndAnnotationNotification object:openURLData]];
return YES;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants