ios - Facebook best auth flow with Accounts.framework -
I have read a lot of information about ACAccounts.framework
and successfully in my application Have integrated.
Honestly all tutorials do not have good error flows and what to do next.
My following Athens works fine:
ACAccountStore * AccountStore = [[ACAquintStore Alok] Init]; AC Account Type * Account Type = [AccountStore Account Type with Identity Identifier: ACaccountTitIf IdentifiersBack]; NSDictionary * Options = @ {ACFacebookAppIdKey: kPSFacebookKey, ACFacebookPermissionsKey: @ [@ "Email"], ACFacebookAudienceKey: ACFacebookAudienceEveryone}; [AccountStore requestAccessToAccountsWithType: ACCOUNTTYPE Option: Option Completed: ^ (BOOL given, NSError * error) {if (given) {NSArray * accounts = [_currentUser.accountStore accountsWithAccountType: ACCOUNTTYPE]; _currentUser.facebook = [first object of the accounts]; Dispatch_assink (transmissions_fill_man_close ()), ^ {authSuccess ();}); } Else {dispatch_async (dispatch_get_main_queue (), ^ {authFailure (error); // to UIL ArtView to go to Settings and add an account? WHAT?}); }}];
If the user has an account in the settings and I trust it and I think about that user.
This actually works as expected, but is provided only when the user has an account in Settings
. Otherwise I would show the warning to go to the user settings
and add the account. I do not want to do that!
Then, the desired flow is:
- If the user has an account in
Settings
, then get it via - If the user does not have an account in
settings
-> - If the user does not have the
facebook
app - go tosafari
login form> facebook book - then go back to the application < - How can I get such a flow (
- Do I need that
Facebook IOS SDK
< Li> Can I merge credentials again with the
I believe that <4> <4>
So my main question is:
Facebook
session and add it to ACAccountStore
manually thanks < / P>
<<>
/ Code> Settings in If the user has
settings
-> not in the Facebook app Go to Facebook
app -> Safari
Facebook
login form - Enter credential -> Automatically go back to application ACAccountStore
(accounts in the iOS system), Facebook A DK does it for me, and I'm just relying on Facebook session (Ice Open). There was still an issue that the session disappears after application restart, and was solved by adding:
[FBSession openActiveSessionWithReadPermissions: allowLoginUI zero: NO completionHandler: ^ (FBSession * session, FBSessionState status, NSError * error) {}];
Comments
Post a Comment