diff --git a/src/ios/ShareExtension/ShareViewController.m b/src/ios/ShareExtension/ShareViewController.m index 5318d46..02e4e8a 100644 --- a/src/ios/ShareExtension/ShareViewController.m +++ b/src/ios/ShareExtension/ShareViewController.m @@ -56,22 +56,37 @@ - (void) openURL:(nonnull NSURL *)url { UIResponder* responder = self; while ((responder = [responder nextResponder]) != nil) { - + NSLog(@"responder = %@", responder); if([responder respondsToSelector:selector] == true) { NSMethodSignature *methodSignature = [responder methodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; // Arguments - NSDictionary *options = [NSDictionary dictionary]; - void (^completion)(BOOL success) = ^void(BOOL success) {}; - - [invocation setTarget: responder]; - [invocation setSelector: selector]; - [invocation setArgument: &url atIndex: 2]; - [invocation setArgument: &options atIndex:3]; - [invocation setArgument: &completion atIndex: 4]; - [invocation invoke]; - break; + void (^completion)(BOOL success) = ^void(BOOL success) { + NSLog(@"Completions block: %i", success); + }; + if (@available(iOS 13.0, *)) { + UISceneOpenExternalURLOptions * options = [[UISceneOpenExternalURLOptions alloc] init]; + options.universalLinksOnly = false; + + [invocation setTarget: responder]; + [invocation setSelector: selector]; + [invocation setArgument: &url atIndex: 2]; + [invocation setArgument: &options atIndex:3]; + [invocation setArgument: &completion atIndex: 4]; + [invocation invoke]; + break; + } else { + NSDictionary *options = [NSDictionary dictionary]; + + [invocation setTarget: responder]; + [invocation setSelector: selector]; + [invocation setArgument: &url atIndex: 2]; + [invocation setArgument: &options atIndex:3]; + [invocation setArgument: &completion atIndex: 4]; + [invocation invoke]; + break; + } } } }