如何将Facebook登录集成到iOS应用中,适用于所有版本?
我花了好几个小时在谷歌和GitHub上找不到一个完整的解决方案。我还阅读了Facebook上的所有文档,并剖析了ios-facebook示例代码。我有一个适用于>=iOS6的工作版本,但是任何低于这个版本的东西都会崩溃(ACAccountStore不存在)。目前,我正在使用一个名为LBFacebook的库进行登录。唯一的缺点是,它再一次不适用于iOS5。
我把头发都拔出来了。FacebookSDK每隔几周就会变化一次。让它一劳永逸地工作,那将是一个奇迹。
发布于 2013-09-01 15:01:13
发布于 2015-09-04 15:03:02
NSString *strName= @"Mohit Thatai";
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login
logInWithReadPermissions: @[@"public_profile", @"email"]
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error)
{
NSLog(@"Error");
}
else if (result.isCancelled)
{
NSLog(@"Cancell");
}
else
{
NSLog(@"Login Sucessfull");
// Share link text on face book
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
[content setContentTitle:@"GPS Tracker"];
[content setContentDescription:[NSString stringWithFormat:@"%@ shared an interesting link\n This might be interesting to you: GPS Tracker for Kids",strName]];
content.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://gpsphonetrackerkids.com"]];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
}
}];https://stackoverflow.com/questions/18555034
复制相似问题