-
Notifications
You must be signed in to change notification settings - Fork 167
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
IOS: The FBSDK not work when facebook app is installed #59
Comments
We need a way to reproduce the issue. Would you be able to provide a minimum reproducible example that we can run and verify ? |
@thebergamo to be more clear, let me reproducible this issue for you.
const loginRequest = await LoginManager.logInWithPermissions(["public_profile", "email"])
if (!loginRequest.isCancelled) {
const accessToken = await AccessToken.getCurrentAccessToken()
const currentProfile = await Profile.getCurrentProfile()
console.log(accessToken) // -> return accessToken object
console.log(currentProfile) // -> return null
} @hm-harshit Is my reproduce exactly like you? If yes, please try to get user information using const getFacebookData = async (token) => {
const fetchResult = await fetch(
"https://graph.facebook.com/v9.0/me?fields=email,name,friends&access_token=" token,
)
const result = await fetchResult.json()
return result
}
const loginRequest = await LoginManager.logInWithPermissions(["public_profile", "email"])
if (!loginRequest.isCancelled) {
const tokenData = await AccessToken.getCurrentAccessToken()
const currentProfile = await getFacebookData(tokenData.accessToken)
console.log(tokenData) // -> return accessToken object
console.log(currentProfile) // -> return your currentProfile
} |
Just to mention that the phrase "while @thebergamo finding solution for this issue" should, in open source terms, be re-written "while I investigate the root cause of the issue and make a PR". No one should be expected to do work for you in an open source repository. If those words are not words you will type - that is, if you are not willing to personally investigate the root cause and post a PR, then an alternative phrase could be "hopefully someone has the extra free time to find the solution for my problem" |
@mikehardy so sorry for my words. I've edited my comment. Thank you so much. |
No problem, and I was not offended or anything, I just take great care to set reasonable expectations for open source repositories. It's all volunteer work essentially, and repositories always need more people to help, so the words are important. Cheers |
not working with this code top 👆 |
So, when you reach in to node_modules and modify this module's code to print out the arguments used to call the native SDK's API, and then you print out all the results to verify what they are, what exactly is shown, and is it different then expectations? That way you may determine if it is a problem in this module, or in the native SDK. And if it's in the native SDK you'll know to go search their issue tracker to see if there is an existing issue or if you need to make a native-level reproduction and post one there so they can fix it |
I tried this code also but it dosen't work ! Anyone here please help me out. |
@mikehardy would you like to suggest any other library that I can use you bypass this issue ? |
@hm-harshit no, this is/was my suggestion, it would actually move us all forward:
|
Any update? I have a similar issue. After press the |
Any Resolutions? |
There will not be resolution until someone that can reproduce this investigates it personally, spending their time to do so, and posts a PR. Someone that can reproduce it please do the work and make the fix, we can merge and release any time if we get a PR |
The underlying SDKs have been updated across several major version boundaries in their versioning systems. You should retest, for sure, using latest v6 version from here |
Hi all, I am still able to reproduce this issue with the latest v6 code, specifically using the example app. Here are the steps I took to do so fb_login_ios.mp4
For this test I created a new Facebook App in the Facebook developer console, and followed the relevant instructions for adding the Facebook login product to the app. It's unlikely that I will be able to PR this myself, but I hope these reproduction steps may help someone else. Thank you everyone who has looked into this so far. |
I won't have time to investigate this personally for a while, so anyone else should take a shot at it. That's how I'd start anyway, if I had time |
Hello, we have the same problem.
The problem occurs when facebook app is present on the phone AND your are not connected on facebook with your native browser |
I am also suffering the same fate, unfortunately. RPReplay_Final1642944668LOW.mp4The problem is only occurring on iOS when the user is logged into the Facebook app on a physical device. This is my environment setup:
Some seem to suggest modifying AppDelegate.m to include Here is how my AppDelegate.m looks:
Adding I am running out of options on this one. Thanks for the work you do on this and I hope my input can provide some further movement on the topic. Best, Jamie |
@jwainwright87 this may not help - I haven't checked this PR yet, but have you tried modifying this related chunk of code inside node_modules to see if it has an effect? https://github.com/thebergamo/react-native-fbsdk-next/pull/179/files ? We just merged a typescript rewrite so I am certain it moved around, but you should hopefully still be able to locate it and try the PR's attempted change? |
@mikehardy Thanks for your response Mike. Here's what I did. I updated
Cleaned iOS build folder, rebuilt the app in xcode and ran on iPad. The result is the same and Have I missed any steps here? Thanks, |
@mikehardy I also tried the following as mentioned in your comment for the PR Running
I then |
I had this problem on Android and the root of the problem is related that Google Play sign in the app for me. |
@hm-harshit Thanks for creating the issue in the facebook-ios-sdk repo but they are unable to offer any support. Any idea how I can modify my AppDelegate.m file (posted above) without breaking everything else? Thanks in advance. |
@jwainwright87 / @hm-harshit it is not that they cannot help, it is that they need a https://stackoverflow.com/help/minimal-reproducible-example based on using their code directly. That means starting here (probably) https://github.com/facebook/facebook-ios-sdk/tree/main/samples/FacebookLoginSample ...and reproducing the bug directly using their APIs with a little throwaway sample app that you toss up on a github. What we'll learn if/when someone does that is whether the problem is in this module (at which point the facebook-ios-sdk team response is exactly right!) or that they have a problem in that SDK (at which point the facebook-ios-sdk now has a repro they can work with, without unreasonably expecting them to bring up a full react-native environment when they are iOS devs) It's a bit more work but it's a critical step I think, to move this forward. I am not an iOS dev by nature (I'm a java guy from when dinosaurs roamed the earth) but even I can usually get a sample app running and reproduce things just by hacking around, so don't be intimidated out of even trying it, you might be surprised :-). Good luck |
@jwainwright87 You should try to add at the end of
I had a similar problem and it was needed. |
Thank you! Confirming that this resolved the issue for me. |
Wow this has resolved the issue! Thank you so much! Forever I was thinking I had to edit the existing - (BOOL)application etc because that contained the original Many thanks! |
I can verify that @scottarnold 's piece of code fixed the issue for us as well. We already had the same call to |
If this is not documented well 🙏 🙏 🙏 if someone could open a PR to the docs and cross-link it to close this out, that would clearly help a lot of people |
This didnt work for us. We initially had this in our AppDelegate.m:
We tried the suggested code by others as well as what the docs suggest when using the RCTLinkingManager, but no luck. |
I had the same exact issue and can also confirm that this code fixes it. Cheers mate! |
I have used solution from here facebookarchive/react-native-fbsdk#785 (comment) |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
facebookarchive/react-native-fbsdk#785 (comment) is the solution which worked for me.... |
Hello there :) Is there any alternative of this solution that works for SceneDelegate because right now the "openURL" method doesn't get called from my AppDelegate. Thanks! |
@michalis-ligopsychakis Hi there! I'm unaware of how to get openURL to work with SceneDelegates, the react-native ecosystem is still entirely based on AppDelegate so I have no experience nor have I even seen how to do it. So I guess it is time to hit the API documentation and start experimenting. I will admit to being quite curious though, I have a similar question I'm unable to answer here invertase/react-native-firebase#6657 and I would love to have an answer if you could post back any of your findings |
Ok @mikehardy .. Thank you for the quick response :) |
Ok I think I figured out a solution..
|
Follow this official Facebook documentation for Guide on SceneDelegate https://developers.facebook.com/docs/ios/getting-started/?sdk=cocoapods |
I have removed below from info.plist LSApplicationQueriesSchemes |
Thank you man, this worked for me as well! |
this fixed my problem, can someone explain how this works? |
check this issue facebookarchive/react-native-fbsdk#785
FBSDK not work when facebook app is installed
The text was updated successfully, but these errors were encountered: