VDPATEL
VDPATEL

Reputation: 416

Opening camera using UIIMagepickerController not display rendering view on iPod Touch on swift

I am working on client app with swift . This is my first app on swift . I am trying to open camera from my app using UIImagePickerController . Below i have added snap of my code . It's working fine on IPhone 5s and 6s with iOS 9.2.1 .But when i am trying to open on iPod Touch with iOS 8.3 it gives black view with button controls. I have attached screen shot also which shows how it looks like. Please help me to come out from this .

Code:

if UIImagePickerController.isSourceTypeAvailable(.Camera) {

       imagePickerViewController = UIImagePickerController()
       imagePickerViewController?.delegate = self
       imagePickerViewController?.allowsEditing = true
       imagePickerViewController?.sourceType = .Camera
       imagePickerViewController?.mediaTypes = [kUTTypeImage as String]
       imagePickerViewController?.cameraCaptureMode = .Photo
       presentViewController(imagePickerViewController!, animated: true, completion: nil)
 }
 else
 {
             print("Sorry cant take picture")
 }

enter image description here

Upvotes: 1

Views: 733

Answers (1)

I tried out the same on my device & it worked fine. So there is no issue with code.

Now i tried to generate the issue which you have on iPod. See this steps:

  • Go to settings > Select your App
  • In that you will see Photos & Camera option with Switch
  • If i switch off there in camera it will start showing black screen while i use camera in that App
  • Just check this out on your iPOD settings & if it is off, make it on. It will start working.

I hope this will guide you.

Upvotes: 1

Related Questions