Open Oshr1 opened 1 year ago
this is what I experience now too
me too :/ did you guys find a solution for this?
Title refers to a delegate, so I guess it's an iOS-specific problem? Does anyone experience the same problem on android?
@CatchABus yeah it's iOS specific, it works on iOS Simulator though (as there's no FB app), but it doesn't work on real iOS device where the Facebook app is installed. It opens a window with a button which says Log In With the Facebook App, which when clicked opens the Facebook App where I can tap on Log in. Then it goes back to that window without closing and resolving.
I am also having this problem. It's like the NSCFacebookUIAppDelegateExt
isn't being used.
I tested this with the new addDelegateHandler
and I can see the events when the user returns from the Facebook app.
const Application = require("@nativescript/core").Application;
if (Application.ios) {
Application.ios.addDelegateHandler('applicationOpenURLOptions', (app, url, options) => {
console.log("HANDLE RETURN FROM FACEBOOK.");
});
}
No idea how to link this up though...
I did some more digging, and have found a fix that utilizes the new addDelegateHandler
added in v8.6.0.
It would be useful if this could be merged into the plugin's init
method so we don't have to add this too...
But to get it working, just add this code after the LoginManager.init();
call:
if (Application.ios) {
// Hook the launch event up with the Facebook SDK delegate.
Application.ios.addDelegateHandler("applicationDidFinishLaunchingWithOptions", (app, launchOptions) => {
return FBSDKApplicationDelegate.sharedInstance.applicationDidFinishLaunchingWithOptions(app, launchOptions);
});
// Hook up the application launch from URL.
Application.ios.addDelegateHandler('applicationOpenURLOptions', (app, url, options) => {
if (url && url.scheme.startsWith("fb")) {
FBSDKApplicationDelegate.sharedInstance.applicationOpenURLSourceApplicationAnnotation(app, url, options.valueForKey(UIApplicationOpenURLOptionsSourceApplicationKey), options.valueForKey(UIApplicationOpenURLOptionsAnnotationKey));
}
});
}
@LewisSmallwood thanks for looking at this :) I tried it now, however I get this error when I get back from the Facebook app: TypeError: FBSDKApplicationDelegate.sharedInstance.applicationOpenURLSourceApplicationAnnotation is not a function
Do you know what can be the problem on my side?
@LewisSmallwood do you know if you have development target set to 13+? I'm reading this on Facebook SDK docs(https://developers.facebook.com/docs/facebook-login/ios/)
iOS 13 moved opening URL functionality to the SceneDelegate. If you are using iOS 13, add the following method to your SceneDelegate so that operations like logging in or sharing function as intended
So I'm curious if that could be the problem for me if I have target set to 13?
Facebook login + firebasr not working properly, FB app opens and after successfully submitting Facebook login the app stays open and not returning to my app