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);
通过拼接地址便可查看传输的文件。