Not getting call to loginViewShowingLoggedInUser from FBLoginView - ios

I am using the Facebook SDK for the first time. I am working with Xcode 5.1 and iOS 7.
I programmatically display FBLoginView:
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(#"viewDidLoad");
// Do any additional setup after loading the view.
if ( !loginView ) {
// loginView =[[FBLoginView alloc] initWithReadPermissions:#[#"basic_info"]];
loginView =[[FBLoginView alloc] initWithReadPermissions:[NSArray arrayWithObjects:#"basic_info", #"user_location", nil]];
}
loginView.delegate = self;
loginView.frame = CGRectOffset(loginView.frame,
(self.view.center.x -(loginView.frame.size.width /2)), 5);
CGPoint vCenter = CGPointMake( CGRectGetMidX(self.view.frame),
CGRectGetMidY(self.view.frame) );
CGPoint lvCenter = CGPointMake( vCenter.x, vCenter.y+100.0 );
loginView.center = lvCenter;
[self.view addSubview:loginView];
[self updateView];
}
I have implemented the required override functions:
#pragma mark - FBLoginViewDelegate
- (void) loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
NSLog(#"loginViewFetchedUserInfo");
[self updateView];
}
- (void) loginViewShowingLoggedInUser:(FBLoginView *)loginView {
NSLog(#"loginViewShowingLoggedInUser");
[self updateView];
}
- (void) loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
NSLog(#"loginViewShowingLoggedOutUser");
[self updateView];
}
- (void)updateView {
NSLog(#"FB updateView");
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection, NSDictionary<FBGraphUser>*FBUser, NSError *error) {
if (error) {
NSLog(#"updateView - error");
} else {
NSLog(#"updateView - good");
NSNumber *owner_id = [NSNumber numberWithLong:[[FBUser id] longLongValue]];
if ( FB_user_id == nil ) {
FB_user_id = owner_id;
NSLog(#"FBUser ID = %#", FB_user_id);
loggedInSession = [FBSession activeSession];
[[NSUserDefaults standardUserDefaults] setObject:[FBUser id] forKey:#"eventOwnerID"];
[self performSegueWithIdentifier:#"continue_to_app" sender:self];
}
}
}];
if ([self checkFacebookSession]) {
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.view setNeedsDisplay];
});
}
The FBLoginView button appears with "Log in with Facebook". I can log in and accept permissions, but the loginViewShowingLoggedInUser override function never gets called.
Someone suggested adding the following:
- (BOOL) application:(UIApplication *) application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
NSLog ( #"application openURL");
NSLog ( #"URL = %#", url);
NSLog ( #"Application = %#", sourceApplication);
// Call FBAppCall's ha
BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
//[LoginUIViewController updateView];
return wasHandled;
}
This code had no effect and was never executed.
What am I doing wrong?

You are using #"basic_info", for this Facebook shows following error when I tried testing your code!
Invalid Scope: basic_info. Use public_profile, user_friends instead
I was interested in knowing where did you add the method:
- (BOOL) application:(UIApplication *) application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
NSLog ( #"application openURL");
NSLog ( #"URL = %#", url);
NSLog ( #"Application = %#", sourceApplication);
// Call FBAppCall's ha
BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
//[LoginUIViewController updateView];
return wasHandled;
}
It should be in your AppDelegate, which works for me.

The read permissions have changed.
Refer this :
[https://developers.facebook.com/docs/apps/changelog#v2_0_permissions
][1]
The Error "invalide scope : basic info use public_profile, user friends instead" clearly states that "basic_info" is invalid and it suggests to make use of "public_profile" or "user_friends" as the new scope.
Change it in the following code:
self.loginView.readPermissions = #[#"basic_info"];
TO
self.loginView.readPermissions = #[#"public_profile"];

Related

iOS : Login with Facebook and open Native Facebook app

I Want open facebook application at login time that already install in the device for login authentication, but always open in the Safari browser.
- facebook button click
-(void)loginButtonClicked
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
// [login setLoginBehavior:FBSDKLoginBehaviorNative];
[login logInWithReadPermissions:#[#"email"] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
NSLog(#"Login process error");
}
else if (result.isCancelled)
{
NSLog(#"User cancelled login");
}
else
{
NSLog(#"Login Success");
if ([result.grantedPermissions containsObject:#"email"])
{
NSLog(#"result is:%#",result);
[self fetchUserInfo];
}
else
{
// [SVProgressHUD showErrorWithStatus:#"Facebook email permission error"];
}
}
}];
}
}
-here to fetch user info
-(void)fetchUserInfo
{
if ([FBSDKAccessToken currentAccessToken])
{
NSLog(#"Token is available : %#",[[FBSDKAccessToken currentAccessToken]tokenString]);
[[[FBSDKGraphRequest alloc] initWithGraphPath:#"me" parameters:#{#"fields": #"id, name, email"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error)
{
NSLog(#"results:%#",result);
NSString *email = [result objectForKey:#"email"];
NSString *userId = [result objectForKey:#"id"];
if (email.length >0 )
{
NSString *accessToken = [[FBSDKAccessToken currentAccessToken] tokenString];
[ref authWithOAuthProvider:#"facebook" token:accessToken
withCompletionBlock:^(NSError *error, FAuthData *authData)
{
if (error)
{
NSLog(#"Login failed. %#", error);
}
else
{
NSLog(#"Logged in! %#", authData);
//Start you app Todo
}
else
{
NSLog(#"Facebook email is not verified");
}
}
else
{
NSLog(#"Error %#",error);
}
}];
}
I Want to open facebook application for login with facebook.
From V4.6.0 it won't redirect to fb app. See below
(v4.6.0 - September 10, 2015) In addition, the SDK dialogs such as
Login, Like, Share Dialogs automatically determine the best UI based
on the device, including SFSafariViewController instead of Safari.
Follow the our Preparing for iOS 9 guide.
Please Use FBLoginView as Facebook SignIn button It automatically detects Facebook app & u can able to login with facebook.
FBLoginView class available in Facebook SDK.
Please set info.plist parameters properly, you may have not provided the URLs like this
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb776035152513539</string>
</array>
</dict>
</array>
and
<key>FacebookAppID</key>
<string>776035152513539</string>
If you are not able to achieve what you want,then you can use these classes.
Header File -
//
// LxFaceBookHandler.h
// KickOffSlotMachine
//
// Created by Prakhar Goyal on 06/08/15.
// Copyright (c) 2015 LOGICNEXT. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
typedef NS_ENUM(NSInteger,LOGINRESPONSE)
{
LOGINRESPONSE_ERROR,
LOGINRESPONSE_CANCEL,
LOGINRESPONSE_SUCCESS
};
#protocol LxFaceBookHandlerDelegate <NSObject>
-(void)DidLogInWithResponse:(LOGINRESPONSE)type;
#end
#interface LxFaceBookHandler : NSObject
#property(weak,nonatomic)id<LxFaceBookHandlerDelegate>delegate;
-(void)InitFaceBookLogin;
//Called from app Delegate
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
#end
and Implementation file is -
//
// LxFaceBookHandler.m
// KickOffSlotMachine
//
// Created by Prakhar Goyal on 06/08/15.
// Copyright (c) 2015 LOGICNEXT. All rights reserved.
//
#import "LxFaceBookHandler.h"
#implementation LxFaceBookHandler
#synthesize delegate = __delegate;
- (instancetype)init
{
self = [super init];
if (self)
{
__delegate = nil;
}
return self;
}
-(void)InitFaceBookLogin;
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:#[#"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
if (__delegate!=nil)
{
if ( [__delegate respondsToSelector:#selector(DidLogInWithResponse:)])
{
[__delegate DidLogInWithResponse:LOGINRESPONSE_ERROR];
}
}
}
else if (result.isCancelled)
{
if (__delegate!=nil)
{
if ( [__delegate respondsToSelector:#selector(DidLogInWithResponse:)])
{
[__delegate DidLogInWithResponse:LOGINRESPONSE_CANCEL];
}
}
}
else
{
if (__delegate!=nil)
{
if ( [__delegate respondsToSelector:#selector(DidLogInWithResponse:)])
{
[__delegate DidLogInWithResponse:LOGINRESPONSE_SUCCESS];
}
}
// if ([result.grantedPermissions containsObject:#"email"]) {
// // Do work
// }
}
}];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
}
#end
Add FBSDKCoreKit.Framework and FBSDKLoginKit.Framework in your project and set your app Delefate like this -
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor=[UIColor blackColor];
SplashViewController *rVC = [[SplashViewController alloc] initWithNibName:#"SplashViewController" bundle:nil];
self.mNavController=[[UINavigationController alloc]initWithRootViewController:rVC];
[self.mNavController setNavigationBarHidden:YES];
self.window.rootViewController=self.mNavController;
[self.window makeKeyAndVisible];
self.handler = [[LxFaceBookHandler alloc]init];
[self.handler application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [self.handler application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
now you can use these classes as on any event suppose on button click-
- (IBAction)FacebookLoginPressed:(UIButton *)sender
{
App.handler.delegate = self;
[App.handler InitFaceBookLogin];
}

Dropbox sdk 401 Error getting for iPhone 5 but not in iPhone 6 for the same app in Xcode 6

I referred below url and try to solve the issue but still not able to fix the issue.
Please help me out.
Dropbox SDK 401 Error
My app is working in iPhone 6 but while running the same app in iPhone 5 or 5s its showing the error:
[WARNING] DropboxSDK: error making request to /1/metadata/dropbox/ALLCREW.TXT - (401) No auth method found.
2014-12-11 16:58:14.628 user_schedule_3[2331:112832] Error loading metadata: Error Domain=dropbox.com Code=401 "The operation couldn’t be completed. (dropbox.com error 401.)" UserInfo=0x7fbb50d851c0 {path=/ALLCREW.TXT, error=No auth method found.}.
the code is given below:
AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
DBSession *dbSession = [[DBSession alloc]
initWithAppKey:#"******h4xl9l4o"
appSecret:#"*******1ujh8"
root:kDBRootDropbox]; // either kDBRootAppFolder or kDBRootDropbox
[DBSession setSharedSession:dbSession];
// NSString *listValue = #"NAME";
return YES;
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
sourceApplication:(NSString *)source annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(#"dropbox linked successfully!");
[[NSNotificationCenter defaultCenter] postNotificationName:#"updateRoot" object:nil];
NSLog(#"came out");
// At this point you can start making API calls
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
View controller:
- (IBAction)didPressLink {
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:self];
NSLog(#"did press link is linked");
} else {
NSLog(#"did press link is reached");
}
}
NSString *filename = #"ALLCREW.TXT";
NSString *localDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
NSString *localPath = [localDir stringByAppendingPathComponent:filename];
[self.restClient loadMetadata:#"/ALLCREW.TXT"];
//[self.restClient loadFile:#"/ALLCREW.TXT" intoPath:localPath];
NSString *contentOfFile = [NSString stringWithContentsOfFile:localPath encoding:NSUTF8StringEncoding error:nil];
NSArray *stringWithEnter = [contentOfFile componentsSeparatedByString: #"\n"];
- (void)restClient:(DBRestClient *)client
loadMetadataFailedWithError:(NSError *)error {
NSLog(#"Error loading metadata: %#", error);
}
- (void)restClient:(DBRestClient *)client loadedFile:(NSString *)localPath
contentType:(NSString *)contentType metadata:(DBMetadata *)metadata {
NSLog(#"File loaded into path: %#", localPath);
[self getEntry ];
[self.tableView reloadData];
[spinner stopAnimating];
self.navigationItem.rightBarButtonItem.enabled = true;
}
- (void)restClient:(DBRestClient *)client loadFileFailedWithError:(NSError *)error {
NSLog(#"There was an error loading the file: %#", error);
}
I had the same issue. The solution ended up being that you had to add:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(#"App linked successfully!");
// At this point you can start making API calls
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
You seem to have this code in:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)source annotation:(id)annotation;
Moving the code to handleOpenURL: should fix the issue.
Also make sure to link Security.framework!
Source: http://innofied.com/integration-of-dropbox-in-ios-applications/

Handling Dropbox authentication response

Dropbox documentation explains by default the response for authentication gets fired into Appdelegate.m
How do I make the same fire my own class's delegate?
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
sourceApplication:(NSString *)source annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(#"App linked successfully!");
// At this point you can start making API calls
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
In info plist url type --> in url schemes just add db-YourAppKey this method will get called.
This method is getting called automatically. I hope you already created app from dropbox developer site and get the appKey and appSecret. Use this code in app delegate NSString* appKey = #"";
NSString* appSecret = #"";
NSString *root = kDBRootDropbox;
NSString* errorMsg = nil;
if ([appKey rangeOfCharacterFromSet:[[NSCharacterSet alphanumericCharacterSet] invertedSet]].location != NSNotFound) {
errorMsg = #"Make sure you set the app key correctly in DBRouletteAppDelegate.m";
} else if ([appSecret rangeOfCharacterFromSet:[[NSCharacterSet alphanumericCharacterSet] invertedSet]].location != NSNotFound) {
errorMsg = #"Make sure you set the app secret correctly in DBRouletteAppDelegate.m";
} else if ([root length] == 0) {
errorMsg = #"Set your root to use either App Folder of full Dropbox";
} else {
NSString *plistPath = [[NSBundle mainBundle] pathForResource:#"Info" ofType:#"plist"];
NSData *plistData = [NSData dataWithContentsOfFile:plistPath];
NSDictionary *loadedPlist =
[NSPropertyListSerialization
propertyListFromData:plistData mutabilityOption:0 format:NULL errorDescription:NULL];
NSString *scheme = [[[[loadedPlist objectForKey:#"CFBundleURLTypes"] objectAtIndex:0] objectForKey:#"CFBundleURLSchemes"] objectAtIndex:0];
if ([scheme isEqual:#"db-APP_KEY"]) {
errorMsg = #"Set your URL scheme correctly in DBRoulette-Info.plist";
}
}
DBSession* session =
[[DBSession alloc] initWithAppKey:appKey appSecret:appSecret root:root];
session.delegate = self; // DBSessionDelegate methods allow you to handle re-authenticating
[DBSession setSharedSession:session];
[DBRequest setNetworkRequestDelegate:self];
// [[DBSession sharedSession]unlinkAll];
if ([[DBSession sharedSession] isLinked])
{
isAccountForDropBox = YES;
}
else{
isAccountForDropBox = NO;
}
//After using this that open url will get call automatically.
These method only respond in AppDelegate.m,you can't use outside it.
To use in your ViewController or any class, you should use post notification
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
sourceApplication:(NSString *)source annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(#"App linked successfully!");
// Post Notify here
[[NSNotificationCenter defaultCenter] postNotificationName:#"applicationDidLinkWithDropbox" object:self];
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
Then receive this notification in your class, in a ViewController for example:
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(dropBoxDidLink:)
name:#"applicationDidLinkWithDropbox"
object:nil];
}
- (void) dropBoxDidLink:(NSNotification *)notification {
if ([[notification name] isEqualToString:#"applicationDidLinkWithDropbox"]) {
//Handle your task here
}
}

Twitter Authorization Login

I'm using STTwitterto interface with Twitter in an iOS app I'm changing for someone. When I call the twitter authorization page for the first time with the following code:
- (void)newUser
{
[[NetworkManager sharedInstance] resetTwitterAPI];
[[[NetworkManager sharedInstance] twitterAPI] postTokenRequest:^(NSURL *url, NSString *oauthToken) {
[[UIApplication sharedApplication] openURL:url];
} oauthCallback:#"tweepr://twitter_access_token" errorBlock:^(NSError *error) {
NSLog(#"Error %s", __PRETTY_FUNCTION__);
}];
}
* Which, in turn, calls this:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
if (![[url scheme] isEqualToString:#"tweepr"]) {
return NO;
}
NSDictionary *d = [self parametersDictionaryFromQueryString:[url query]];
NSString *token = d[#"oauth_token"];
NSString *verifier = d[#"oauth_verifier"];
[[UserLoadingRoutine sharedRoutine] setOAuthToken:token verifier:verifier];
return YES;
}
* Which finally calls this:
- (void)setOAuthToken:(NSString *)token verifier:(NSString *)verifier
{
[[[NetworkManager sharedInstance] twitterAPI] postAccessTokenRequestWithPIN:verifier successBlock:^(NSString *oauthToken, NSString *oauthTokenSecret, NSString *userID, NSString *screenName) {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
dict[#"nickname"] = screenName;
dict[#"token"] = oauthToken;
dict[#"secret"] = oauthTokenSecret;
dict[#"user_id"] = userID;
self.userDict = dict;
NSMutableArray *users = [self.availableUsers mutableCopy];
if (![users containsObject:dict]) {
[users addObject:dict];
}
self.availableUsers = [users copy];
[[NSUserDefaults standardUserDefaults] setObject:self.availableUsers forKey:#"availableUsers"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self selectUserWithIdentifier:dict[#"nickname"]];
} errorBlock:^(NSError *error) {
NSLog(#"Error");
}];
}
The twitter authorization page, the first time it comes up, has login and password fields to fill in as shown below at This Screenshot. If I bring the authorization page up again via the above code to authorize under a different user, This Screenshot appears and I need to sign out on the top. Is there a way to do this progmatically?
Append &force_login=1 to the URL string in -[STTwitterOAuth postTokenRequest:oauthCallback:errorBlock:].
Let me know if it works.

iOS Facebook SDK delegate methods not called

I see this question asked in several other posts but nothing seems to work for me. After following the FB login guide I had a working prototype that would allow users to authenticate with FB. However this guide instructs you place all FB OAuth logic directly into the AppDelegate and that is not ideal for me since I will support more than just FB authentication. So what I have done is move the login logic into it's own class. Since then it seems that the FB delegate methods do not get called after a user successfully authenticates with FB and control should be passed back to my application.
I have a modal login view which takes my FacebookAuth class as a delegate. When I attempt to create a session the FB login page appears and I authorize my application. After that no other delegate methods are called. Can anyone provide some hints?
#interface FacebookAuth()
#property (nonatomic, strong) User *sessionUser;
#end
#implementation FacebookAuth
#synthesize sessionIsOpen = _sessionIsOpen;
#synthesize sessionUser = _sessionUser;
-(id)initWithViewDelegate:(id<AuthorizationViewDelegate>)viewDelegate
{
NSAssert(viewDelegate != nil, #"FacebookAuth must be initialized with a view delegate.");
self = [super init];
if (self) {
self.viewDelegate = viewDelegate;
}
return self;
}
-(id)init
{
self = [super init];
if (self) {
self = [self initWithViewDelegate:nil];
}
return self;
}
-(BOOL)sessionIsOpen{
return (FBSession.activeSession.state == FBSessionStateOpen);
}
-(void)requestSessionUserWithSuccess:(void (^)(User *))success Failure:(void (^)(NSError *))error{
if(!self.sessionIsOpen){
error([NSError errorWithDomain:#"Session Closed" code:0 userInfo:nil]);
return;
}
if(self.sessionUser == nil){
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *err) {
if (!err) {
User *ses_user = [[User alloc]initWithId:user.id first:user.first_name last:user.last_name sessionToken: [[[FBSession activeSession] accessTokenData] accessToken]];
self.sessionUser = ses_user;
success(ses_user);
} else{
error(err);
}
}];
} else{
success(self.sessionUser);
}
}
-(void)openSession
{
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
}
-(void)closeSession{
[FBSession.activeSession closeAndClearTokenInformation];
self.sessionUser = nil;
self.sessionIsOpen = NO;
};
-(void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:{
self.sessionIsOpen = YES;
[self.viewDelegate loginSuccess];
}
break;
case FBSessionStateClosed:{
self.sessionIsOpen = NO;
}
break;
case FBSessionStateClosedLoginFailed:{
[FBSession.activeSession closeAndClearTokenInformation];
self.sessionIsOpen = NO;
[self.viewDelegate loginFailure:error];
}
break;
default:
break;
}
}
-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [FBSession.activeSession handleOpenURL:url];
}
I apologize for the large code snippet but I don't want to leave out anything that may be valuable in assisting.
After calling
-(void)openSession:
The facebook authentication page appears and I authorize the application. After that I was expecting the FB delegate method to be called:
-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
It never is. Do I need to declare this class as a type of FB delegate? I am using the latest Facebook SDK available.
Any help would be great.

Resources