Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I test a camera in the iPhone simulator?

People also ask

Can we test camera on iOS simulator?

You can't test camera on simulator. You can only check the photo and video gallery.

How do I use iPhone simulator?

To launch a Simulator without running an app Choose Xcode > Open Developer Tool > Simulator. Control-click the Xcode icon in the Dock, and from the shortcut menu, choose Open Developer Tool > Simulator.

How do you inspect iPhone simulator?

You'll need to go to Settings > Advanced and check the Show Debug Menu option. Then you'll see the option to open the web inspector for the Simulator right from that menu. With the Web Inspector open, you can debug inside the Simulator just like you could right in a desktop browser with DevTools.

Is there an iPhone simulator?

Appetize.io is a web-based iOS simulator. To use it, you need to upload a simulator build of an app. You develop your app using a platform such as Xcode or Xamarin before you can test it with Appetize.io.


There are a number of device specific features that you have to test on the device, but it's no harder than using the simulator. Just build a debug target for the device and leave it attached to the computer.

List of actions that require an actual device:

  • the actual phone
  • the camera
  • the accelerometer
  • real GPS data
  • the compass
  • vibration
  • push notifications...

I needed to test some custom overlays for photos. The overlays needed to be adjusted based on the size/resolution of the image.

I approached this in a way that was similar to the suggestion from Stefan, I decided to code up a "dummy" camera response.

When the simulator is running I execute this dummy code instead of the standard "captureStillImageAsynchronouslyFromConnection".

In this dummy code, I build up a "black photo" of the necessary resolution and then send it through the pipelined to be treated like a normal photo. Essentially providing the feel of a very fast camera.

CGSize sz = UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation]) ? CGSizeMake(2448, 3264) : CGSizeMake(3264, 2448);
UIGraphicsBeginImageContextWithOptions(sz, YES, 1);
[[UIColor blackColor] setFill];
UIRectFill(CGRectMake(0, 0, sz.width, sz.height));
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

NSData *imageData = UIImageJPEGRepresentation(image, 1.0);

The image above is equivalent to a 8MP photos that most of the current day devices send out. Obviously to test other resolutions you would change the size.


I never tried it, but you can give it a try! iCimulator

 iCimulator


Nope (unless they've added a way to do it in 3.2, haven't checked yet).