Using the FBLoginView in the current 3.1 Facebook SDK doesn't produce what I believe it should be producing as an output. Generating a basic [[FBLoginView alloc] init]; and the frame the size of the current view controllers frame, it only shows the below WITHOUT the "Login" button:
http://cl.ly/image/1t102j1t452l
What does it take to make the FBLoginView show properly?
Try this:
In .h file:
Use this delegate <FBLoginViewDelegate>
FBLoginView *loginview;
In.m file in someMethod:
if(!loginView)
loginView = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions, user_photos,status_update"]]; // Whatever permissions you need
loginview.frame = self.view.bounds; //whatever you want
loginview.delegate = self;
[self.view addSubview:loginview];
Add these methods:
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
NSLog(@"Logged In");
}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user {
NSLog(@"user Id %@",user.id);
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
// Called after logout
NSLog(@"Logged out");
}
Hope this helps.
I noticed that I was missing FacebookSDKResources.bundle in my project. When I added it, it started working.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.