Facebook SDK for iOS v3.1のスタートガイドに従って、FacebookSDKをxCodeプロジェクトに追加しStoryboard
ます。
私はそこで説明されているすべてのステップを実行しました。
FacebookSDKのSampleフォルダーに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
何かを投稿したいときは、このページに移動します。