纯新手一个,第一次用AVOS
我是这样上传视频的:
//得到拍摄视频
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
//写入文档
NSData *videoData = [NSData dataWithContentsOfURL:videoURL];
uploadFile = [AVFile fileWithName:@"video.mp4" data:videoData];
[uploadFile saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
NSLog(@"成功 %d",succeeded);
} progressBlock:^(NSInteger percentDone) {
NSLog(@"%ld",(long)percentDone);
}];
到了下载的时候,直接崩掉了,那个下载的AVFile应该怎么初始化呢? 看文档我只能理解根据objectId下载了
这是我想下载并得到下载进度的代码:
NSDictionary *dict = @{@"download": videoID}; //videoID就是上传那个AVFILE的objectId
NSLog(@"objectId: %@",[dict objectForKey:@"download"]);
AVFile *downloadFile = [dict objectForKey:@"download"];
[downloadFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
NSLog(@"123");
} progressBlock:^(NSInteger percentDone) {
NSLog(@"%ld",(long)percentDone);
}];
本人太新手了。。 搜问题也没搜到类似问题的, 厚脸皮自己发帖问一下好了。。在线等 - -
问题解决了- -
在此之前要先
[AVFile getFileWithObjectId:videoID withBlock:^(AVFile *file, NSError *error)