0

i have used UIImagePickerController in our app, But permission alert is not appear on first time itself. Any solution? Thanks in Advance.

Gopik
  • 255
  • 2
  • 17
  • Please post your code you are using. – Bot May 03 '16 at 19:38
  • Do you have the explicit code that asks for permission? Can we see some code please then we can answer this better. – Andy May 03 '16 at 19:43
  • Ok. i didn't add explicit code to ask for permission. here is my code, - (void)showcamera { UIImagePickerController *picker = [[UIImagePickerController alloc]init]; picker.delegate = self; picker.modalPresentationStyle = UIModalPresentationCurrentContext; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.allowsEditing = YES; self.imagePickerController = picker; [self presentViewController:self.imagePickerController animated:YES completion:^{ NSLog(@"camera loaded"); }]; } – Gopik May 03 '16 at 19:48
  • Also i got snapshot warning like this issue - http://stackoverflow.com/questions/25884801/ios-8-snapshotting-a-view-that-has-not-been-rendered-results-in-an-empty-snapsho Any suggestions? – Gopik May 03 '16 at 19:50
  • Try making UIImagePickerController *picker an instance of controller like @property(strong,nonatomic) UIImagePickerController *picker; And than initialize the instance – Ahmad Ishfaq May 03 '16 at 19:51
  • Yes i did that but no luck. – Gopik May 03 '16 at 19:53

2 Answers2

1

iOS caches the user response to permission requests, and that cache will persist even if you delete and reinstall the app. If you're in the simulator, the lazy solution would be to reset the simulator. On the device, if your permission alert isn't showing, then I would suspect your phone already has a privacy entry in settings for your app.

ghostatron
  • 2,620
  • 23
  • 27
1

If your code is correct, then this solution will work for you.

1.Uninstall the app from the device.
2.Restart the device.
3.After restarting change the date to next day in date and time settings.
4.Then again restart the device.
5.Now run the app.You can see the permission alert.

This solution worked for me.If its helpful for you, let me know.

Madhu
  • 439
  • 2
  • 14