簡體   English   中英

iOS FacebookSDK圖像共享

[英]iOS FacebookSDK image share

我正在使用以下代碼將圖像從我的iOS上傳到Facebook。

NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:@"MY TEST MSG..." forKey:@"message"];
[params setObject:UIImagePNGRepresentation(self.editImageView.image) forKey:@"picture"];


[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/photos" parameters:params HTTPMethod:@"POST"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if (!error) {
            NSLog(@"uploaded");
        } else {
            NSLog(@"Graph API Error: %@", [error description]);
        }
}];

我的應用卡住了幾分鍾,並顯示錯誤消息。 誰能幫幫我嗎?

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:3];
UIImage *picture = FilterImage;
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
[variables setObject:graph_file forKey:@"file"];
[variables setObject:[NSString stringWithFormat:@"Hello testin"] forKey:@"message"];
[fbGraph doGraphPost:@"me/photos" withPostVars:variables];
NSLog(@"Now log into Facebook and look at your profile & photo albums...");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM