I have an iPhone app and I can log in through Facebook via safari and then it redirects back to my app but fbDidLogin is not called and fbDidNotLogin is not called.
I can detect when my app gets focus back but m_pFacebook.accessToken is still null at that time.
I can't alter Facebook.m because I don't have one. My project is using the Facebook static library and I'm not totally sure what that means it looks like we use Facebook.h but not Facebook.m
- (void)attempt
{
m_pFacebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:self];
if (![m_pFacebook isSessionValid])
{
NSLog( @"\nFacebook session is not valid" );
[m_pFacebook authorize:nil];
}
else
{
NSLog( @"\nFacebook session is valid" );
}
}
// Pre iOS 4.2 support
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
NSLog( @"\nhandleOpenURL:%@", url );
return [m_pFacebook handleOpenURL:url];
}
// For iOS 4.2+ support
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog( @"\nopenURL:%@", url );
return [m_pFacebook handleOpenURL:url];
}
- (void)fbDidLogin
{
NSLog(@"\nFacebook Did Log In");
NSLog(@"\nAccess Token is %@", m_pFacebook.accessToken );
NSLog(@"\nExpiration Date is %@", m_pFacebook.expirationDate );
}
- (void)fbDidNotLogin:(BOOL)cancelled
{
NSLog(@"\n Facebook Failed to log in");
}