iOS stopped asking user for Photo Library Permission

不羁岁月 提交于 2019-11-30 03:09:08

What is happening is iOS is saving the permission granted to your app mapped to the bundle ID, if the app is deleted this data persists for 24 hours, this avoids re prompting the user if they reinstall the app (perhaps after mistakingly deleting an app).

This also happens for Push Notification prompts.

As a workaround, I quote Apple concerning the Push Notifications:

Resetting the Push Notifications Permissions Alert on iOS

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on.

Source: Apple Technical Note TN2265

As the question is for Photo Library permissions, there is other way without changing the system clock and turning the device off.

You can just go to "Settings" app

(General > Reset > Reset Location & Privacy).

This will make the apps ask for photo library, location and other permissions again.

Restting via the settings app is difficult to automate. We use simctl to reset the simulators content and settings in an automated fashion to reset the permissions dialog. This will require re-installing the app in the simulator, but again simctl can accomplish this.

You can check this permission by two types -

  • In Simulator
    you can do Simulator/Reset Content and Settings.
  • In Physical device (iPhone, iPad)
    You can change date, at least difference should be 24 hours.

but first uninstall app from device then restart then apply this thing then it will work.

If you are using the iOS Simulator, resetting it using Simulator/Reset Content and Settings... seems to reset this setting. Of course, you'll then need to reinstall your app onto it.

You just need to follow bellow point no need to reinstall or delete app.

  • App remove from background
  • Go to Settings->General->Reset-> click on Reset Location & Privacy

Hope you got help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!