Reputation: 1218
I wanted to browse iPhone device for files like text,pdf,images etc. like in android we can browse in memory card to upload or attach files. But for iPhone, i searched a lot but i didn't find any solution to do this.
Upvotes: 1
Views: 269
Reputation: 985
Never do that becose your app will be rejected,
if you do like that and upload your app on App Store.....
Never use jailbreak in your app friend..
Upvotes: 3
Reputation: 46
For regular device, the answer is NO.
Every app in iOS runs on its sandbox environment. Your app can't see any data placed outside of the sandbox.
For security reasons, iOS places each app (including its preferences and data) in a sandbox at install time. A sandbox is a set of fine-grained controls that limit the app’s access to files, preferences, network resources, hardware, and so on. As part of the sandboxing process, the system installs each app in its own sandbox directory, which acts as the home for the app and its data.
For jailbroken device, it will break the snadbox environment. So it may be possible to access any files in your device.
Upvotes: 3
Reputation: 4789
Yes, it is possible but it uses private API's. Your app will be rejected if you use this and submit to the app store. Check this opensource lib FileSystem
Upvotes: 0
Reputation: 891
To pick image use UIImagePicker
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePicker.sourceType];
imagePicker.delegate = self;
imagePicker.editing = YES;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:nil];
}
To pick files and pdf, use FileManager
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager directoryContentsAtPath:@"/MYFOLDER"];
NSArray *pdfList = [list filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF ENDSWITH '.pdf'"]];
NSLog(@"%@", pdfList);
Upvotes: 0