0

I am loading URL on UIWebView on that URL photo select option is there, when I click on "choose file" photo select alert will come like below in image :--- /Users/ArjunSinghBaghel/Desktop/Screen Shot 2017-02-13 at 11.06.02 PM.png

but when I click on "Photo Library" that page going to disappear.

Please help my out ..

Thanks in advance.

2 Answers2

1

You probably need to set proper permissions in Info.plist file. Namely Privacy - Photo Library Usage Description and Privacy - Camera Library Usage Description.

Alternatively, you can use WKWebView. I just tested Swift implementation in Swift Playgrounds on my iPad with IOS 10 and it is working fine. Please see https://gist.github.com/kiritmodi2702/b8a674bb66803c1397cab55030ae2c54.

Martin Polak
  • 124
  • 6
  • I already added both things , its happening in iOS10 and its giving waring -- Warning: Attempt to present on whose view is not in the window hierarchy! – Arjun Singh Baghel Feb 14 '17 at 09:25
  • Although it is for IOS 8, looks similar to your problem - [http://stackoverflow.com/questions/26376940/upload-photo-with-uiwebview?rq=1](http://stackoverflow.com/questions/26376940/upload-photo-with-uiwebview?rq=1) – Martin Polak Feb 14 '17 at 09:45
0

As the warning logged in debugger suggests, the UIImagePickerController is not getting invoked appropriately.
Consider the example,

- (void)takePhoto:(UIButton *)sender{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    [self presentViewController:picker animated:YES completion:nil]; 
}

Confirm whether the self being used is a subclass of UIViewController which has been added to the UINavigatorController Bar stack.
In the current scenario, it appears self is a UIView instance.

ystack
  • 1,785
  • 12
  • 23