我想将本地资源文件夹视频文件(12345.mp4)转换为base64编码字符串,然后从API发送到服务器端,但Web团队告知无效的base64编码字符串。这是正确的吗?
这是我的代码:
NSString *base64String = @"";
NSError *error;
NSData *videoData;
NSString *strVideoPath = [[NSBundle mainBundle] pathForResource:@"12345" ofType:@"mp4"];
videoData = [[NSData alloc]initWithContentsOfFile:strVideoPath options:NSDataReadingMappedIfSafe error:&error];
base64String = [videoData base64EncodedStringWithOptions:0];