简体   繁体   English

iOS FacebookSDK图像共享

[英]iOS FacebookSDK image share

I am using the following code to upload an image from my iOS to Facebook. 我正在使用以下代码将图像从我的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]);
        }
}];

My app got stuck for couple of minutes and show the error message. 我的应用卡住了几分钟,并显示错误消息。 Can any one please help me? 谁能帮帮我吗?

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