Kaushil Ruparelia
Kaushil Ruparelia

Reputation: 1178

A Picker controller similar to UIImagePickerController to pick files ios 7

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

Answers (1)

Viral Savaj
Viral Savaj

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

Related Questions