我已成功将 facebook 集成到 ios 6 中,但我注意到该应用程序的一个奇怪行为。每当我尝试使用 facebook 登录时,一切正常,但是当任何其他具有他/她凭据的用户尝试登录时,就会出现错误。我不知道它的解决方案是什么。
我正在使用 facebook sdk 示例代码作为参考。对于登录,我只是设置登录的视图框架。FBLoginView 的协议实现如下:
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView
{
BOOL canShareAnyhow = [FBNativeDialogs canPresentShareDialogWithSession:nil];
// first get the buttons set for login mode
self.postStatusBtn.enabled = YES;
self.shareWithFriendsBtn.enabled = YES;
self.viewFriends.enabled = YES;
}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user
{
// here we use helper properties of FBGraphUser to dot-through to first_name and
// id properties of the json response from the server; alternatively we could use
// NSDictionary methods such as objectForKey to get values from the my json object
// setting the profileID property of the FBProfilePictureView instance
// causes the control to fetch and display the profile picture for the user
self.profilePic.profileID = user.id;
self.loggedInUser = user;
NSLog(@"%@",user);
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView
{
BOOL canShareAnyhow = [FBNativeDialogs canPresentShareDialogWithSession:nil];
self.postStatusBtn.enabled = NO;
self.shareWithFriendsBtn.enabled = NO;
self.viewFriends.enabled = NO;
if (!self.viewFriends.enabled)
{
self.viewFriends.titleLabel.textColor = [UIColor grayColor];
}
if(!self.shareWithFriendsBtn.enabled)
{
self.shareWithFriendsBtn.titleLabel.textColor = [UIColor grayColor];
}
if (!self.postStatusBtn.enabled)
{
self.postStatusBtn.titleLabel.textColor = [UIColor grayColor];
}
self.profilePic.profileID = nil;
self.loggedInUser = nil;
}
提前谢谢...!!