使用iOS将视频上传到Firebase时出错257

时间:2017-02-16 08:55:51

标签: ios firebase google-cloud-platform

我正在尝试使用iOS将视频上传到firebase,从模拟器尝试时会上传,但在尝试从设备上传时,会出现以下错误:

 Cannot get file size: Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_1179.MOV” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV, NSFilePath=/var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV, NSUnderlyingError=0x14f34870 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}   /var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV 2017-02-16 14:17:14.211491 ALTR[979:318794] Body file is unreachable: /var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV   Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_1179.MOV” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV, NSFilePath=/var/mobile/Media/DCIM/101APPLE/IMG_1179.MOV, NSUnderlyingError=0x4c474d50 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

请帮助我。

这是我的代码:

for (NSURL *videoURL1 in videoUrls)
    {
        imageName1 ++;

        NSDateFormatter *formatter;
        NSString        *dateString;

        formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"dd-MM-yyyy-HH:mm:ss"];

        dateString = [formatter stringFromDate:[NSDate date]];

        dateString =[NSString stringWithFormat:@"%@-%d", dateString ,imageName1];

        NSString *imgUniqueName = [NSString stringWithFormat:@"%@-%@", dateString ,@"AlterVideo"];
        NSLog(@"Unique Image Name : %@",imgUniqueName);

        riversRef =[storageRef child:[NSString stringWithFormat:@"images/%@",imgUniqueName]];

        // Upload the file to the path "images/rivers.jpg"
        FIRStorageUploadTask *uploadTask = [riversRef putFile:videoURL1 metadata:nil completion:^(FIRStorageMetadata *metadata, NSError *error)
                                            {
                                                if (error != nil)
                                                {
             /* handing error   */
                 }
                                                else {
                /* get response from firebase after success */
                        } }]; }

0 个答案:

没有答案