ios - How to authenticate UIViewController for Facebook API -


Actually if I use the code given below in the rep where I have added Facebook login button provided by Facebook SDK If it was started, then it works (enters successful and print out details). The representative class that I create and use the button is called "log-in visual controller":

NSError * error) {if (error!) {// success! NSLog (@ "user information:% @", result) Include your code to handle results here; } And {nslog (@ "unsuccessful"); // An error occurred, we need to see the error // see: https://developers.facebook.com/docs/ios/errors}}];

However when I try to use it in another view controller named Profile View, it works (regardless of the active session) regardless of the session! So my wild guess is that I need a way to prove this scene so that I can access the user's information to Facebook?

Please do I am doing wrong? Thanks alottt!

ps How do I use this to check that the user is already logged in, so it should go to the profile view:

DViewController.m: logged in VIPU controller * view controller = [[log in] Visual Controller Alok] Init]; ProfileViewController * profileviewController = [[Profile View Control Alloc] init]; If (! FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {CatSession * transition = [Catering Animation]; Transition.duration = 0.3; Transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; Transition.type = kCatransitionPush; Transition.subtype = kCatransitionFromRight; [Self. View.windows Player add animation: for transition that: zero]; [Self-current model view controller: Animated profile viewer controller: No]; } And {catenation * transition = [citation animation]; Transition.duration = 0.3; Transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; Transition.type = kCatransitionPush; Transition.subtype = kCatransitionFromRight; [Self. View.windows Player add animation: for transition that: zero]; [Self-Present Model Week Controller: Animated Visual Controller: No]; }

Thanks again a million! :))))

First of all: there is no need to prove your viewpoint here Just can prove your application To solve your problem, my first guess tries to use this component to log into this user:

  FBLoginView * loginView = [[FBOginiv Alok] init]; [Self.view addSubview: loginView];   

Use this callback function to handle user logins:

  // This method will be called when user information is received - (zero) LoginViewFetchedUserInfo: (FBLoginView *) Logindrishy user: (ID & lt; FBGraphUser & gt;) user {self.profilePictureView.profileID = user.id; Self.nameLabel.text = user.name; }   

Do not forget to add these rows to your app representative:

  - (BOOL) Application: (UIApplication *) application openURL: (NSURL ) *) Url sourceApplication: (NSString *) sourceApplication annotation: (id) annotations {// call FBAppCall's handleOpenURL: Facebook app sourceApplication BOOL to control reactions Thahandl = [FBAppCall handleOpenURL: url sourceApplication: sourceApplication]; // If you require, you can add your app-specific URL handling code here; }   

In a second view, you can check whether the user is logged in by the following method:

  if (FBSession.activeSession. state == FBSessionStateCreatedTokenLoaded) {//}}   

If you want to log out the user, keep in mind to store your FBOOnViewview (as a strong asset). I hope this will solve your problem, Cheers

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -