我一直在这个工作了几天,现在似乎无法在任何地方找到直接的答案或例子。我正尝试从iPhone应用程序中将视频上传到Facebook。我可以连接到Facebook(并上传了图片),而无需使用一个问题:iPhone Facebook的视频上传
_facebook = [[Facebook alloc] initWithAppId:kAppID];
_permissions = [[NSArray arrayWithObjects:@"publish_stream", @"offline_access",nil] retain];
[_facebook authorize:_permissions delegate:self];
但是我似乎无法让我的视频上传工作。我当前的代码是:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"mp4"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
data, @"video",
nil, @"callback",
@"test", @"title",
@"upload testing", @"description",
@"EVERYONE", @"privacy",
nil];
[_facebook requestWithMethodName:@"video.upload"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
而且由于视频上传呼叫具有不同的服务器来进行,我改变了restserver网址facebook.m文件内:
static NSString* kRestserverBaseURL = @"https://api-video.facebook.com/method/";
当我运行这个上传崩溃的错误:
facebookErrDomain err 353.
任何帮助,将不胜感激。
编辑:
随着Zoul的帮助下,我现在已经实现了下面的代码(我没有做什么改变了他上传类也不附带的SDK版本)。该请求不会再出现错误,但不会上传任何内容。
我初始化Facebook的对象和上传对象:
- (void)fbDidLogin{
_upload.accessToken = _facebook.accessToken;
_upload.apiKey = kApiKey;
_upload.appSecret = kApiSecret;
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"mp4"];
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
data, @"",
@"test", @"title",
@"upload testing", @"description",
@"EVERYONE", @"privacy",
nil];
[_upload startUploadWithURL:fileURL params:params delegate:self];
}
我不能添加该代码,在我的Facebook-IOS-SDK FBVideoUpload类是不存在的..你能帮帮我 – 2011-04-05 06:23:12
现在我得到错误'无法从访问令牌检索会话密钥.' – 2011-04-05 07:35:07
但我的更新提取好了在这种情况下没有会话错误 – 2011-04-05 07:43:58