Skip to content

Commit

Permalink
Update FacebookConnectPlugin.m
Browse files Browse the repository at this point in the history
  • Loading branch information
guylando authored Feb 21, 2019
1 parent 0e2dc48 commit fa9d58e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ios/FacebookConnectPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,11 @@ void FBMethodSwizzle(Class c, SEL originalSelector) {
+ (void)load
{
FBMethodSwizzle([self class], @selector(application:openURL:sourceApplication:annotation:));
FBMethodSwizzle([self class], @selector(application:openURL:options:));
}

// This method is a duplicate of the other openURL method below, except using the newer iOS (9) API.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
- (BOOL)swizzled_application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
if (!url) {
return NO;
}
Expand All @@ -800,10 +801,10 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(N
// NOTE: Cordova will run a JavaScript method here named handleOpenURL. This functionality is deprecated
// but will cause you to see JavaScript errors if you do not have window.handleOpenURL defined:
// https://github.com/Wizcorp/phonegap-facebook-plugin/issues/703#issuecomment-63748816
NSLog(@"FB handle url: %@", url);
NSLog(@"FB handle url using application:openURL:options: %@", url);

// Call existing method
return [self swizzled_application:application openURL:url sourceApplication:[options valueForKey:@"UIApplicationOpenURLOptionsSourceApplicationKey"] annotation:0x0];
return [self swizzled_application:application openURL:url options:options];
}

- (BOOL)noop_application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
Expand All @@ -822,7 +823,7 @@ - (BOOL)swizzled_application:(UIApplication *)application openURL:(NSURL *)url s
// NOTE: Cordova will run a JavaScript method here named handleOpenURL. This functionality is deprecated
// but will cause you to see JavaScript errors if you do not have window.handleOpenURL defined:
// https://github.com/Wizcorp/phonegap-facebook-plugin/issues/703#issuecomment-63748816
NSLog(@"FB handle url: %@", url);
NSLog(@"FB handle url using application:openURL:sourceApplication:annotation: %@", url);

// Call existing method
return [self swizzled_application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
Expand Down

0 comments on commit fa9d58e

Please sign in to comment.