【发布时间】:2012-12-10 11:07:25
【问题描述】:
在我的应用程序中,我正在尝试使用 FbConnect 在 facebook 墙上上传视频,我的代码看起来不错,但我不知道为什么我的视频没有上传,因为如果我使用相同的代码方法上传图像,它会成功上传图像facebook.here 是我用于上传图片的代码
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"2" ofType:@"png"];
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfFile:filePath];
UIImage *img = [[UIImage alloc] initWithData:data];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"Picture",
nil];
[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
[img release];
对于视频,我正在尝试此代码,所以对于
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myVideo" ofType:@"mp4"];
NSURL *url = [NSURL URLWithString:filePath];
NSData *videoData = [NSData dataWithContentsOfURL:url];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mp4",
@"video/quicktime", @"contentType",
@"Video Test Title", @"title",
@"Video Test Description", @"description",
nil];
[_facebook requestWithGraphPath:@"me/videos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
上面的代码没有给我任何错误,但是它在标签中返回了一些文本消息(操作无法完成)。这不是在图片上传的情况下。所以有人可以指导我如何修复它。谢谢
【问题讨论】:
标签: iphone xcode url video fbconnect