Reputation: 1178
Just as we have UIImagePickerController
to pick images into our iOS app. Is there a way to import the files in a similar manner as well? iOS 8
suggests a UIDocumentPickerViewController
, but only for files in iCloud. Is there a way to import files in iOS 7
?
Thanks!
Kaushil Ruparelia
Upvotes: 1
Views: 671
Reputation: 3389
iOS 8 allows you UIDocumentPickerViewController
for picking files on iCloud. Other file inside your iDevice could not load or find with this controller.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager contentsOfDirectoryAtPath:documentsDirectory error:nil];
for (NSString *s in fileList){
NSLog(@"%@", s);
}
You can access files from your App Sandbox, and Some other type like, Images/Videos through UIImagePickerViewController
.
In short, There is no way to get other files directly through any controller :(
HTH, Enjoy Coding !!
Upvotes: 1