如何使用NSFileManager保护或加密视频文件? [英] How to secure or encrypt video files with NSFileManager?

查看:100
本文介绍了如何使用NSFileManager保护或加密视频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在iOS尤其是视频上保护文档目录或(库目录)中的文件.我不希望用户可以通过Xcode或iExplorer应用程序将视频下载到文档目录中.从服务器下载后,我需要保护库"目录内部的私有内容(或)如何加密视频文件.请帮助我.

I need to secure files in document directory or (Library directory) on iOS especially videos. I don't want user can download videos in document directory by Xcode or iExplorer app. I need to secure the private content inside of the Library directory (or) how to encrypt video file after downloading from server. Please help me on this.

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@.mp4",videoUrlName]]];
NSString* path = [NSString stringWithFormat:@"%@.mp4",videoName];
AFDownloadRequestOperation *videoDownloadRequest = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:path shouldResume:YES];

[videoDownloadRequest setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile)
 {
     float progress = totalBytesReadForFile / (float)totalBytesExpectedToReadForFile;
     NSString *progressMessage = [NSString stringWithFormat:@"%@%@ / %@", @"Downloading...", [self fileSizeStringWithSize:totalBytesReadForFile], [self fileSizeStringWithSize:totalBytesExpectedToReadForFile]];
 }];

[videoDownloadRequest setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
 {
     UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Message" message:[NSString stringWithFormat:@"%@ has been added to your Playlist",detailCellView.titleLabel.text] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
     [alertView show];
 }
                                            failure:^(AFHTTPRequestOperation *operation, NSError *error)
 {


 }];
[[NSOperationQueue mainQueue] addOperation:videoDownloadRequest];

推荐答案

对于从App Store下载的应用程序,Apple已阻止访问大多数Apps目录

Apple has blocked access to most of the Apps directory for apps downloaded from the App Store Refer this

在提交应用程序之前,我们需要做一件事

We need to do one thing before the app submission

https://developer.apple.com/library/ios/qa/qa1719/_index.html

这篇关于如何使用NSFileManager保护或加密视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆