How to open other user profile in Facebook application using FB scheme - ios

I am developing application where the user has to provide a facebook link by login to actual an facebook account. Where I am successfully getting link of logged in user.
Reference Link(Edited wrong URL) :
https://www.facebook.com/app_scoped_user_id/YXNpZX3o4dhgdfhYmZAoZAWlEOGdSNVJuM05xcEdZAcmplelpYaF85bRbFBCSXpNVmJEdsdfgsdgjl1WG0wOEVdsdfhggfhGb0ZA4TZAnRFR0EtZA1ZAJaGtjYnh5YURZATUM4ZIa2V1gdfhdDV1WHhR/
I am able to store it and retrieve to reuse. It is working fine to navigate user under installed application and logged in user profile to same profile. But if I am going to open another registered user with another profile link and added as my contact list. While going to access their actual profile to open under facebook native profile (Edited wrong URL)
https://www.facebook.com/app_scoped_user_id/WlEOGdSNVJuM05xclelpYaF85bYXNpZX3o4dhgdfhYmZAoZARbFBCSXpNVmJEdsdfgsdgjl1WG0wOEVdsdfhggfhGb0ZA4TZAnEdZAcmpRFR0EtZA1ZAJaGtjYnh5UM4ZIa2V1gdfhdDV1WHhRYURZAT/
I am not able to launch his profile.
To open profile under installed native facebook application I am getting success for:
fb://profileapp_scoped_user_id=YXNpZX3o4dhgdfhYmZAoZAWlEOGdSNVJuM05xcEdZAcmplelpYaF85bRbFBCSXpNVmJEdsdfgsdgjl1WG0wOEVdsdfhggfhGb0ZA4TZAnRFR0EtZA1ZAJaGtjYnh5YURZATUM4ZIa2V1gdfhdDV1WHhR/`
But not able to redirect to:
fb://profile?app_scoped_user_id=WlEOGdSNVJuM05xclelpYaF85bYXNpZX3o4dhgdfhYmZAoZARbFBCSXpNVmJEdsdfgsdgjl1WG0wOEVdsdfhggfhGb0ZA4TZAnEdZAcmpRFR0EtZA1ZAJaGtjYnh5UM4ZIa2V1gdfhdDV1WHhRYURZAT/`
Please let me know the appropriate solution.

Related

iOS Facebook SDK - Opening link to users profile works in Safari, but not if user has Facebook app installed on their phone

I've setup the Facebook SDK with my current iOS application in which I can login and retrieve the current user's facebookUID and other profile information.
I'm currently trying to set it up, so a user can open up another user's Facebook profile from within my app, however, I'm noticing that if the user has the Facebook app already installed on their phone, the request will open up the Facebook app and it will then result in The page your requested was not found error.
However, if the user doesn't have the Facebook app installed on their phone, it will then open up the person's profile correctly in Safari for some reason.
Any ideas what's going on?
Here's how I'm currently trying to open the person's profile:
let fbURLWeb: NSURL = NSURL(string: "https://www.facebook.com/\(facebookUID)")!
UIApplication.sharedApplication().openURL(fbURLWeb)
Also, has anyone gotten this to work in the new SDK, or could this be a bug?
Thanks in advance!

ios - multi facebook account on one device

I'm having an iOS app, need Facebook login to share something to wall. Everything is ok until I received new feedback from customer. Let me describe this case.
Apple have integrated Facebook into iOS system, user just needs to login via Setting, it is so easy for user. But my customer does not want to do that, they want user to login Facebook inside app and use it instead of Facebook of iOS system. Problem is here, there is a case: user has already logged in Facebook account A via iOS system, then user opens app and login Facebook inside app with other Facebook account B. After that, user shares a picture. Requiment is this picture should be shared on wall of Facebook account B (of app), but this picture appeared on wall of Facebook account A(of iOS system).
I just wonder do we have any solutions to resolve this case? Please give me any ideas you all have in mind after reading.
Thanks,
Ryan
I faced the same problem with Facebook SDK whenever a user login from any app using Facebook it change userid returned with the token which leads to share on the latest opened account.
if you open Facebook from a browser you will get this message from Facebook " we got confused please re-login "
so i took the same approach i saved user-id User(A) and whenever user share i check id coming with token if it changed i show " Facebook account changed please relogin " & i log all users out.
check this link may be helpful: https://www.facebook.com/help/community/question/?id=10205949056147843

Facebook login error "User is not allowed to see the application."

Hi: I have submitted my app to the App Store. I have Facebook login feature in my app. When I try to login to Facebook from devices I have I am able to do it seamlessly. However Apple has rejected my app saying " When we tap the Facebook icon to sign up we are taken to mobile Safari where we receive a message that states :
User is not allowed to see the application.: The user is not allowed to see this application per the developer set configuration.
Not sure how will I be able recreate this issue. I installed my app on 3 different devices and was able to login without any errors. I checked my app setting on Facebook Status and Review section of Facebook and I have enabled my general public. Not sure what else I am missing. I just feel very dejected. Can anyone please help me figure this out? I am using parse as my backend service and logging users using parse Facebook login.
Thank you very much!
Another reason this will happen is if you are logged in as a test user from a different app than the one you are trying to sign in to. Facebook test users are app-specific.
Sign out of Facebook and back in with a test user from the correct app.
Go to Safari > http://m.facebook.com > logout
In cases where app sign in with safariviewcontroller, sometimes it contains test user of different app
In my case, I was using wrong facebook application id in the code. So added the correct id & it worked for me.
This issue occurs because Apple testers used the same Facebook test account which was created to test any other app and they did not logged out from that account(forgotten to log out) and that facebook test account doesn't have the permission for the current app in review which is why this issue occurs,
You can follow the given link to replicate the issue by creating an an test account.
http://samwize.com/2014/07/23/error-with-facebook-login-using-test-users/
Steps to create Facebook test account
https://developers.facebook.com/docs/apps/test-users#managetool
We had this problem, and it turned out that the problem app didn't have a namespace set up in the Settings > Basic tab. Creating one is the solution to this.
Recently I have faced this same issue. Presently Facebook doesn't allow you to login from any Facebook id as you app is in development mode. There are 3 possible solutions that work for me:
Use only that id for Facebook Log In Testing with which you are working in Facebook for developer.
In Facebook for Developer-> Login to your Account-> Open app->Roles-> Test Users-> Add->Submit-> Edit on newly created random tester account->"Change Name and Password for this Test User"-> Provide a Name and handy password for testing.->Submit.(Use the given random generated mail id and password for testing Facebook login through your app.
3)In Facebook for Developer-> Login to your Account-> Open app->Roles->Roles->Testers->Add Testers->Provide Facebook Id for the user you want to add as tester->Submit
To get Facebook Id for a valid user. Login to Facebook with the Id you want to make as facebook tester in your development process.Then goto profile and in URL of browser you see id=(some_random_number). Copy that Id and paste it into Add Tester section of Developer account. It will be in pending state until the valid user accept the inviation.
I had something similar when validating to apple too,
I still don't get it now but for some reason the facebook secret id had been erased from the parse configuration.
You must check that point too
I don't know if that was the reason or not but for me this happened only after I signed the application with a release key, so I made the app 'public'. Probably the test users doesn't work for public applications.
We had this problem, and the solution is to use the same FB test accounts that was created from the same FB App. So if the App get rejected from App, then you should send to Apple a FB test account with password.
my side
I was using wrong facebook application id in the code. So added the correct id & it worked for me.

How to get back to the app after registering with facebook account?

I am trying to build an app that requires facebook authentication like registering users through their facebook account. Problem is after user logs into facebook am not able to get back into my app
In the Info section or info.plist of the project, there is a tab of URL types. In URL Types section you have to enter your facebook id that you got by creating facebook developer's account with 'fb' in prefix. Also identifier needs to be entered so that the OS knows which app to get back again

Facebook AccessToken from iOS doesn't have access to email permission

My app supports Facebook login and will be released to Apple Appstore real soon. I was testing the Facebook login for a while and it seemed to work all the time until now. When I login, the access token return by Facebook does not have email as one of the permission and I do need email for registering with my app. On developer.facebook.com under settings for my app, I have the following setup
User & Friend Permissions: email user_about_me user_birthday
Extended Permissions: read_friendlists
I also got the accessToken from my device and used https://developers.facebook.com/tools/debug/ and pasted my access token in there but it doesn't have email as one of the scope (the only scope listed is user_friends).
The app on Facebook is set to live (non-sandbox) so everyone can access it. Also on iOS, I do not have my app listed under Settings->Privacy->Facebook even after I give my app access to Facebook by successfully signed into Facebook. When I press login with Facebook, it opens Facebook website and says the following "'My App' will receive the following info: your public profile and friend list." and it doesn't mention email in there.
I have removed Facebook app from iOS, logged out of Facebook account from iOS settings, restarted the device and also removed my app and installed again and nothing seems to be working for iOS. We do have an Android version of our app, and that is working (able to get email) without any problem.
Any help is appreciated.
Edited:
Also on Facebook it says that my app accessed email (for my profile) on Oct 25th. So it was able to access email on that day.
However you are requesting the login you have to manually request the e-mail on top of basic permissions. You do so by putting under the readPermissions an array that contains the string email, like so...
fbLoginView.readPermissions = #[#"email"]
Or in openActiveSessionWithReadPermissions:allowLoginUI:completionHandler put the first argument as #[#"email"].
Weirdly, I've found that the app permissions do not often correlate the permissions that the app grabs.

Resources