App通过iTunes与电脑相互传输资料

iPhone用户怎么通过iTunes传输资料,下面先上一个方法:连接iTunes,

ituns与iphone传输资料

并不是所有app都支持文件传输,需要在info-plist里面添加属性Application supports iTunes file sharing ,值为YES。

添加属性

iTunes右边展示的是App内部Document目录:

iPhone内部与iTunes共享目录

利用这个特点,我们可以通过iTunes传输视频音频等资源,app内通过对此目录的遍历,播放资源。

//Documents路径

NSString *path=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];

NSFileManager *fileManager = [NSFileManager defaultManager];

NSError *error = nil;

NSArray *fileList = [[NSArray alloc] init];

//fileList便是包含有该文件夹下所有文件的文件名及文件夹名的数组

fileList = [fileManager contentsOfDirectoryAtPath:path error:&error];

NSLog(@"Documents路径%@,fileList%@",path,fileList);

通过拼接地址便可查看传输的文件。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容