iPhone camera in simulator

2020-07-25 23:10发布

Is there a way to test code using iPhone camera in the simulator?

(Somebody must have written something - you could have a replacement component that simulates the camera)

2条回答
做个烂人
2楼-- · 2020-07-25 23:42

In the simulator there are some sample photo library images that you can access.

Use: UIImagePickerControllerSourceTypePhotoLibrary

查看更多
ゆ 、 Hurt°
3楼-- · 2020-07-25 23:50

If you want to test your actual camera API usage, you would have to closely emulate a fairly large non-trivial portion of the AVFoundation framework.

If you just want to test the rest of your app, you could just ifdef out all the camera related stuff and replace your image capture and preview data with a static png.

查看更多
登录 后发表回答