NSC*_*ool 0 iphone url video xcode fbconnect
在我的应用程序中我试图在Facebook墙上使用FbConnect上传视频我的代码看起来很好但我不知道为什么我的视频没有上传如果我使用相同的代码方法上传图像它成功上传图像在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];
Run Code Online (Sandbox Code Playgroud)
而对于视频,我正在尝试此代码
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];
Run Code Online (Sandbox Code Playgroud)
上面的代码没有给我任何错误,但它在标签中重新调整了一些文本消息(操作无法完成).哪些不是图像上传.所以可以指导我如何修复它.谢谢
试试这些:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myVideo" ofType:@"mp4"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
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];
Run Code Online (Sandbox Code Playgroud)
希望这能帮助你.对我来说工作正常.现在添加这些行.
| 归档时间: |
|
| 查看次数: |
808 次 |
| 最近记录: |