我在我之前的iOS应用版本上实现了FBLoginView
,适用于iOS 6和7。最近,在iOS 8发布之后,我将我的Facebook Framework升级到最新版本,以下是实现相同FBLoginView
按钮的结果。
我尝试使用以前版本的Facebook Framework,但我仍遇到同样的问题。
以下是我的代码中以编程方式FBLoginView
self.fbBtn = [[FBLoginView alloc] init];
self.fbBtn.frame = CGRectZero;
self.fbBtn.readPermissions = @[@"public_profile", @"email"];
self.fbBtn.delegate = [FacebookDelegateHelper sharedObject];
[self addSubview:self.fbBtn];
[self.fbBtn setTranslatesAutoresizingMaskIntoConstraints:NO];
我做错了什么?
答案 0 :(得分:0)
工作的那个是:
FBLoginView *loginView = [[FBLoginView alloc] init];
loginView.frame = CGRectMake(x, y, w, h); // Your fbButton position
loginView.delegate = [FacebookDelegateHelper sharedObject];
[loginView siazeToFit];
[self addSubview:loginView];
这应该会使您的按钮出现。然后,您的其余代码可能位于已声明FBLoginViewDelegate
在FacebookSDK中有一个名为HelloFacebookSDK的示例供您参考。