0
我使用最新的Facebook SDK在Facebook上使用提要對話框共享功能共享文本消息。在Facebook上分享文字味精工作正常,但我面臨的問題就像再次登錄對話框出現後點擊共享,即使我有有效的會議和登錄用戶。Facebook iOS SDK提要對話框共享問題
- (BOOL)openSessionAllowingLoginUI:(BOOL)allowLoginUI
{
NSArray *permissions = [[NSArray alloc] initWithObjects:@"offline_access",@"publish_actions",@"read_stream", nil];
return [FBSession openActiveSessionWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceOnlyMe
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
DLog(@"Facebook Error : %@", error);
if (!error) {
[self publishPost:self.shareMessage andLink:self.shareLink];
}
}];
}
- (void)publishPost:(NSString *)message andLink:(NSString *)url
{
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"sample", @"name",
self.shareMessage, @"description",
self.shareLink, @"link",
nil];
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
NSLog(@"Error publishing post.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled post publishing.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"]) {
// User clicked the Cancel button
NSLog(@"User canceled story publishing.");
} else {
// User clicked the Share button
[self displaySuccessMessage];
}
}
}
}];
}
你真的認爲有人可以幫助你沒有分享[你有什麼嘗試](http://mattgemmell.com/2008/12/08/what-have-you-tried/)? –
你的意思是代碼嗎? – user1667968
哦..當然! –