0
我跟隨Getting Started with the Facebook SDK for iOS v3.1將Facebook SDK添加到我的xCode項目Storyboard
。將Facebook SDK添加到我的xCode項目中Storyboard
我做了所有描述的步驟。
我們在Facebook SDK的示例文件夾中有一個HelloFacebookSample。它包括這樣的代碼:
- (void)viewDidLoad {
[super viewDidLoad];
// Create Login View so that the app will be granted "status_update" permission.
FBLoginView *loginview = [[FBLoginView alloc] init];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
[loginview sizeToFit];
}
// Post Status Update button handler; will attempt to invoke the native
// share dialog and, if that's unavailable, will post directly
- (IBAction)postStatusUpdateClick:(UIButton *)sender {
// Post a status update to the user's feed via the Graph API, and display an alert view
// with the results or an error.
NSString *name = self.loggedInUser.first_name;
NSString *message = [NSString stringWithFormat:@"Updating status for %@ at %@",
name != nil ? name : @"me" , [NSDate date]];
// if it is available to us, we will post using the native dialog
BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self
initialText:nil
image:nil
url:nil
handler:nil];
if (!displayedNativeDialog) {
[self performPublishAction:^{
// otherwise fall back on a request for permissions and a direct post
[FBRequestConnection startForPostStatusUpdate:message
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[self showAlert:message result:result error:error];
self.buttonPostStatus.enabled = YES;
}];
self.buttonPostStatus.enabled = NO;
}];
}
}
這樣,採樣工作正常,但是當我想有它在我自己的項目,我有這樣的問題:
它成功添加FBLoginView我self.view。但是當我Login
然後想發佈的東西我只是去這個頁面:
您是否在設置應用程序中配置了任何iOS6 Facebook帳戶?通常情況下,如果沒有配置帳戶,您將在iOS 6上收到此消息。 – rckoenes
我想在模擬器上測試它。不是設備。我怎樣才能做到這一點?正如我所說的樣本爲我工作,那麼爲什麼這個作品和我自己的不是? – Ali
即使在模擬器去設置和添加Facebook的帳戶,所以你可以發佈 –