简体   繁体   中英

Convert .mov to base64 encoded string IOS

I am trying to convert media files in my IOS app to base 64 encoded strings. When I convert an image, I successfully see the encoded string on the console.

 NSData *videoData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"photo" ofType:@"jpg"]];
NSString *base64Encoded = [videoData base64EncodedStringWithOptions:0];
NSLog(@"%@", base64Encoded);

But when I try to give a .mov file, it does not print anything.

 NSData *videoData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"movie" ofType:@"mov"]];

Can someone please tell me what is that I am doing wrong? Or how can I convert .mov file to base64 encoded string?

Thanks

Check the below link and you will be able to find the solution.

http://cocoadev.com/BaseSixtyFour

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM