6

I'm working on iOS simulator and am facing issues for requesting permissions.

My app was working properly and it could access to photo library, camera and location service. But after installing new XCode (8.1), I run the app on simulator, the app is not allowed to use photo library or camera or location service any more.

I tried to ask the permission programmatically, but it did not show permission request dialog and always return denied status even though I added the privacy descriptions and bundle display name.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Capella
  • 881
  • 3
  • 19
  • 32
  • Run the Settings app. Go to your app's settings page. Enable the permissions. – rmaddy Nov 02 '16 at 18:07
  • @rmaddy Unfortunately, I cannot see my app on settings page. – Capella Nov 02 '16 at 18:18
  • @KiritModi Thank you for your suggestion but if we do not add the permissions in info.plist, the app will be crashed. I added them already and it does not show permission alert at all. :( – Capella Nov 10 '16 at 07:52
  • Are you saying your app doesn't appear in Settings at all? Not even under Privacy? Any app that is successfully installed and has the proper usage keys should show up there. It is possible there is a regression. If you file a radar and attach a sample project we can take a look. – russbishop Nov 14 '16 at 00:32
  • @russbishop Just a simple code to show photo gallery. – Capella Nov 14 '16 at 19:25

3 Answers3

12

I found the issue. This is because your Xcode is not put in Applications folder. Move Xcode to this folder and enjoy.

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
1

Make sure your .plist looks like this

<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>

And also if you disabled any changes to photo library privacy in your restrictions your app won't be able to use your photo library (it won't even ask for permission) until you turn off restrictions.

Tuc3k
  • 1,032
  • 9
  • 12
-3

Try to delete the simulator in ~/Library/Developer/CoreSimulator/Devices/xxxxx-xxx-xxxx, and copy a new one from other machine

Vojtech Ruzicka
  • 16,384
  • 15
  • 63
  • 66