I am trying to take image with camera on share extension. Is it possible to do? Currently, in my main app, I write like this.
self.pickerController = [[UIImagePickerController alloc] init];
[self.pickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
[self.pickerController setDelegate:self.delegate];
self.pickerController.showsCameraControls = NO;
//In main VC, I write like this
[self presentViewController:[ImageTakingHelper sharedInstance].pickerController animated:YES completion:nil];
It is okay in my main app but in my share extension, it show black screen for camera view. How shall I do?
You can't do it. Remember, your share extension is operating in someone else's app. It can only do a small range of things there, and using the camera is not one of them. (Even if you could do it, their app might not have permission to use the camera.) Also, your share extension does not own the screen, so it can't present the image picker.
Apple's documentation about this limitation can be found here: https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html