I'm working with SFSafariViewController, and ran into the following issue: The user is presented with an upload image button, when clicked the device properly displays multiple options, one of which is the camera. When the user selects the camera, it loads the camera but the screen is black, and the action button is greyed out. However if the user selects library, the selected image is properly uploaded.
I did verify that the app has camera permissions turned on.
I tried implementing the fixes found here and here, but to no avail.
Anyone else encounter this issue?
Code:
import UIKit
import SafariServices
class ViewController: UIViewController, SFSafariViewControllerDelegate
{
private var urlString:String = "https://example.com"
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewDidAppear(animated: Bool)
{
super.viewDidAppear(animated)
let svc = SFSafariViewController(URL: NSURL(string: self.urlString)!)
svc.delegate = self
self.presentViewController(svc, animated: true, completion: nil)
}
func safariViewControllerDidFinish(controller: SFSafariViewController) {
super.dismissViewControllerAnimated(true, completion: nil)
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
-----Update #1-----
After resetting privacy settings and trying to upload image directly from camera, I am not getting "SafariViewService Would Like to Access The Camera, which I think may be the problem. Because after I accept, the screen is still black, I'm wondering why it's not saying my app name like "FooBar" Would Like Access... Perhaps this misalignment is why the camera screen is black. Just not sure how to change it.
-----Update #2-----
This appears to be a SFSafariViewController issue, as I implemented WKWebView and the camera works fine.