This question already has an answer here:
Hi friends i am doing camera app. i need to test the app in simulator
but i can't able to access the iOS simulator
camera. Any help for my problem. If not possible in simulator
means i need to access my system camera. Whether it is possible?I tried Image picture view controller but it not works .Any help will be appreciated.
The below code only i tried..
self.imagePicker = [[UIImagePickerController alloc] init];
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.usingPopover = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
sourceType = UIImagePickerControllerSourceTypeCamera;
self.usingPopover = NO;
}
[self.imagePicker setSourceType:sourceType];
self.imagePicker.allowsEditing = NO;
self.imagePicker.delegate = self;
if (sourceType != UIImagePickerControllerSourceTypeCamera) {
self.popover = [[UIPopoverController alloc] initWithContentViewController:self.imagePicker];
self.popover.delegate = self;
[self.popover presentPopoverFromRect:popoverFrame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[self presentModalViewController:imagePicker animated:YES];
}
It's not possible to access camera of your development machine to be used as simulator camera. Camera functionality is not available in any
iOS
version and any Simulator. You will have to use device only for testing camera purpose.Simulator doesn't have a Camera. If you want to access a camera you need a device. You can't test camera on simulator. You can only check the photo and video gallery.