使用新的Facebook SDK在iPhone上发布Facebook Friend's Wall

时间:2013-03-12 09:58:47

标签: iphone facebook ios6

我想使用FBDialog将一些文字和照片发布到我朋友的一面墙上。 我有这样的方法

 - (void)apiDialogFeedFriend:(NSString *)friendID :(NSString *)mImageSTR{
    currentAPICall = kDialogFeedFriend;
    FBSBJSON *jsonWriter = [FBSBJSON new];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               friendID, @"to",
                               @"I'm using the Hackbook for iOS app", @"name",
                               @"Hackbook for iOS.", @"caption",
                               @"Check out Hackbook for iOS to learn how you can make your iOS apps social using Facebook Platform.", @"description",
                               @"http://m.facebook.com/apps/hackbookios/", @"link",
                               @"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", @"picture",
                               actionLinksStr, @"actions",
                               nil];

    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [[delegate facebook] dialog:@"feed"
                      andParams:params
                    andDelegate:self];

}

通过这些,我可以回复dialogCompleteWithUrl FBDialogDelegate方法。 我已经像这样实现了这个委托方法:

    - (void)dialogCompleteWithUrl:(NSURL *)url {
 if (![url query]) {
        return;
    }

    NSDictionary *params = [self parseURLParams:[url query]];
    switch (currentAPICall) {
        case kDialogFeedUser:
        case kDialogFeedFriend:
        {
            // Successful posts return a post_id
            if ([params valueForKey:@"post_id"]) {
                [self showMessage:@"Published feed successfully."];
                NSLog(@"Feed post ID: %@", [params valueForKey:@"post_id"]);
            }
            break;
        }
        case kDialogRequestsSendToMany:
        case kDialogRequestsSendToSelect:
        case kDialogRequestsSendToTarget:
        {
            // Successful requests return the id of the request
            // and ids of recipients.
            NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
            for (NSString *paramKey in params) {
                if ([paramKey hasPrefix:@"to["]) {
                    [recipientIDs addObject:[params objectForKey:paramKey]];
                }
            }
            if ([params objectForKey:@"request"]){
                NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
            }
            if ([recipientIDs count] > 0) {
                [self showMessage:@"Sent request successfully."];
                NSLog(@"Recipient ID(s): %@", recipientIDs);
            }
            break;
        }
        default:
            break;
    }
}

在这里,我将url的正确值设为fbconnect://success?post_id=100001402819851_418640698226650

现在,我的问题是,在我朋友的墙上,我的帖子没有看到/可见。

任何帮助都将不胜感激。

0 个答案:

没有答案