在facebook ios上传图片 [英] upload image on facebook ios
本文介绍了在facebook ios上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我在facebook上使用iphone app上传图片。我没有url.i只有图片。但我不能上传到脸书。如果我可以使用网址然后我可以上传它。请帮助我。
please help me to upload image on facebook using iphone app.here i dont have the url.i just only have the image.but i cant upload it on face book.if i can use an url then i can simply upload it.please help me.
请发给我上传图片的代码。
i已经创建了相对于fbconnect ios的facebook实例和其他代码。
please send me the code for upload image. i already create facebook instance and other codes relative to fbconnect ios.
推荐答案
facebook ios api附带的DemoApp包含在示例中上传照片的代码:
The DemoApp that comes with the facebook ios api contains the code to upload a photo in the sample:
https://github.com/facebook/facebook-ios-sdk/tree/master/sample/DemoApp
/**
* Upload a photo.
*/
- (IBAction)uploadPhoto:(id)sender {
NSString *path = @"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[_facebook requestWithMethodName:@"photos.upload"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
[img release];
}
这篇关于在facebook ios上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文