0

enter image description hereI am wrapping up webapp inside my iOS app and showing the contents using UIWebview.

Everything is working fine. There are 2 button in Webview which asks to take a picture/video and second one is attach photo. I have enable Privacy settings in plist file for both Camera/Photo Library

The issue is i am not getting the ccess msg when first time i try to access either camera/photo library. Also, camera is showing plain view like it has not started. And if i clicked on video button inside camera, its crashing. And if i click on Photo Library button, window will open and will not show any photo to attach.

I tried to find post on SO, but others are getting issue when they showing webview on modally presentedViewController I am not presenting the view controller modally. I am using Xcode 8 and iOS 10 on devices. This is working fine on iOS 9 device.

Does anyone have any idea about this?

Nitya
  • 449
  • 1
  • 8
  • 24
  • can you please post some code – Naveen Ramanathan Nov 04 '16 at 17:39
  • I am not writing any code to open camera/Photo Library because those buttons are within webview. I enabled privacy setting in info.plist file. I have attached part of plist where i am enabling them. The same is working abosultely fine on iOS 9. – Nitya Nov 04 '16 at 17:50
  • first of all, are you making a phonegap app. If not, then there should be a code to open camera/photo – Rajan Maheshwari Nov 04 '16 at 18:00
  • it may be worth trying your page in a WKWebView. The camera permissions are new in iOS 10 and UIWebView is ancient (since iOS 2) and in my experience, its pretty buggy and crash happy. – Josh Homann Nov 04 '16 at 18:30
  • @RajanMaheshwari: I am not using phonegap. Like i mentioned those buttons are within webview, so when we click on those button within webiview , we see options to take a picture/video similar to Safari if you click on any attach files button. but here when i click any of these buttons, applications either doesn't start the camera. – Nitya Nov 04 '16 at 19:19

1 Answers1

0

You have to dismiss the the view by using

override func dismiss(animated flag: Bool, completion: (() -> Void)?)
    {
        if self.presentedViewController != nil {
            super.dismiss(animated: flag, completion: completion)
        }

    }

You have to use this method in which controller contains your webview. Your problem should be gone but if dose not solved yet and app restart after attaching the file or image. Then probably you are using

viewDidAppear(_ animated: Bool)

Just use viewDidLoad instead of viewDidAppear(_ animated: Bool)

Tom
  • 4,257
  • 6
  • 33
  • 49
Mashqur
  • 9
  • 2