I'm trying to pick file from Files App using UIDocumentPickerViewController but I can't see Select button for multiple selection in picker. Why this is happening? am i doing anything wrong? Can anyone help?
Code snippet :
NSArray *arrContents = #[#"public.content",#"public.item",#"public.composite-content",#"public.data",#"public.database",#"public.calendar-event",#"public.message",#"public.presentation",#"public.contact",#"public.archive",#"public.disk-image",#"public.text",#"public.plain-text",#"public.utf8-plain-text",#"public.utf16-external-plain-text",#"public.utf16-plain-text",#"com.apple.traditional-mac-plain-text",#"public.rtf"];
UIDocumentPickerViewController *dvc = [[UIDocumentPickerViewController
alloc]initWithDocumentTypes:arrContents inMode:UIDocumentPickerModeImport];
dvc.delegate = self;
[self presentViewController:dvc animated:true completion:nil];
set dvc.allowsMultipleSelection = true; after initialising UIDocumentPickerViewController.
Related
I want to import a document into my application. I have created a Demo to import Document. A demo is working. below is the code of the Demo to open UIDocumentPickerViewController.
-(IBAction) btnOpenClicked{
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:[self allowedUTIs] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
[self presentViewController:documentPicker animated:true completion:nil];
}
-(NSArray*)allowedUTIs{
return #[#"public.data",#"public.content",#"public.audiovisual-content",#"public.movie",#"public.audiovisual-content",#"public.video",#"public.audio",#"public.text",#"public.data",#"public.zip-archive",#"com.pkware.zip-archive",#"public.composite-content",#"public.text"];
}
The same code is implemented in my actual project. UIDocumentPickerViewController open and App is able to import file but the issue is that in the actual app I am not able to see any buttons in the header. thought there is action happen but buttons are not visible. Please check screenshot of the Demo and actual app.
Your app is probably setting a global UINavigationBar tint color appearance. You can just reset the appearance for UIDocumentPickerViewController only by putting this code somewhere in your application:didFinishLaunchingWithOptions: function and the bar buttons will return to their original blue.
if #available(iOS 11.0, *) {
UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).tintColor = nil
}
For Objective C:
-> by putting this code somewhere in your application:didFinishLaunchingWithOptions:
[[UINavigationBar
appearanceWhenContainedInInstancesOfClasses:
#[[UIDocumentBrowserViewController class]]] setTintColor: nil];
i cannot seem to get this right. ive looked at several tutorials with no luck. i realize it is a simple task, which is why i am so confused on why it isnt working for me.
i have a programmatically made button inside an expanding cell and when you press it, it is suppose to access the camera to take a picture. i have this code:
- (void)buttonPressed:(UIButton *)button {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[picker setDelegate:self];
//picker.allowsImageEditing = NO;
[self presentModalExpandingCell:picker animated:YES];
picker.showsCameraControls = YES;
}
the error appears in line 5. and says "no visible #interface for 'ExpandingCell' declares the selector 'presentModalExpandingCell:animated:'" i have "" in the .h file so i have no idea what to do.
any help will be greatly appreciated. thanks in advance.
Have you declared the method "presentModalExpandingCell" in your class? Because, if not, that is why the compiler is throwing that error.
I'm adding a new iOS8 UIDocumentMenuViewController to my app, and have set the allowedUTIs to only allow PDF files:
NSArray* docTypes = #[ (NSString*)kUTTypePDF ];
UIDocumentMenuViewController* picker = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:docTypes inMode:UIDocumentPickerModeImport];
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
[picker release];
However, when selecting a document from Dropbox it is still listing all files regardless of type. Is this expected behaviour? Is there another way to filter which file types the user can select? Or do I just need to show a "Sorry, we don't handle files of that type!" message when the user selects the wrong kind of file?
I want to upload multiple video to server using ASIHttDataFormRequest.For selecting video ,I am using ImagePickerViewController But it doesn't give the option to select multiple video.
Bellow is the code, which is used to open imagePicker and but unable to select multiple video.
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentViewController:imagePicker animated:YES completion:nil];
Please help me by giving some clue or code. Thanks in Advance
Use this sample
https://github.com/B-Sides/ELCImagePickerController
For video multiple selection refer
Use ELCImagePickerController to pick video
Hope it helps you..
Here is the library to take a photo or select from library: https://github.com/fulldecent/FDTake
This works great so far for photos. Video is in progress.
I am new to iOS. I am creating a dummy app to upload an audio file from iOS device on local server. So I was wondering if there is a way to open the audio gallery and select the required audio file to upload. Similar to an image gallery.
Is it possible to open audio list and select necessary audio file? If not, what is the alternative?
Add the MediaPlayer.framework in your project
#import <MediaPlayer/MediaPlayer.h>
Display like this:
MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
mediaPicker.delegate = self;
mediaPicker.allowsPickingMultipleItems = NO;
[self presentViewController:mediaPicker animated:YES completion:nil];
Implement delegate <MPMediaPickerControllerDelegate>
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(#"You picked : %#",mediaItemCollection);
}
You should use MPMediaPickerController class for accessing audio files. Refer this for same.