iOS13 Provisional Location Permission

谁都会走 提交于 2019-12-13 11:22:10

问题


Since apple has deferred the "Always Allow" permission and only OS can and will ask for that permission based on its own convenience, it is hard to understand what all the scenarios are.

If you see the WWDC video: https://developer.apple.com/videos/play/wwdc2019/705/

The guy clearly says at 04:14, "you ask for requestAlwaysAuthorization, apple provides you with the max option of "While In Use", but at the same time the delegate callback says, the app has "Always Allow permission"". This works as expected, and my app gets the location updates, only If I keep it opened. At 04:35 he says, start Geofence activity as a background-tracking/always-allow requirement. This is where it confuses me, If I put my app in background, location updates are stopped. Why am I asked to setup a geofence for a user who is already in motion even when my delegate call back received "Always Allow" permission?

At 05:22, the pop up which solidifies the provisional always allow permission only comes up (at OS convenience), when you lock the device and unlock it, after putting it in the background as discussed in above paragraph. But all the data in between is lost. My app tracks user's trips and this will completely kill the valid use case of recording user's movement in a vehicle.

Even if I follow the video and create a geofence when app goes to the background and then start to move, nothing happens until I lock and unlock the device. This seems to be pretty useless.


回答1:


Why am I asked to setup a geofence for a user who is already in motion even when my delegate call back received "Always Allow" permission?

You’re not. You’ve misunderstood the video. He gives that as an example of using Always powers. It’s just an example.

At 05:22, the pop up which solidifies the provisional always allow permission only comes up (at OS convenience), when you lock the device and unlock it, after putting it in the background as discussed in above paragraph. But all the data in between is lost.

No it isn’t. Listen to what he says in the video. If the user now accepts Always, the withheld delegate message is delivered.

this will completely kill the valid use case of recording user's movement in a vehicle.

No it won’t. That use case has nothing to do with anything you said previously. If your app is tracking location in the foreground and goes into the background with background location mode and keeps tracking, it is in use. So all you need for that is When In Use. So all that Always stuff is irrelevant to you.

That is the whole point of the video. Don’t ask for Always unless you need it. If you do ask for it, use it, or you won’t get it. But you, it appears, don’t need it.



来源:https://stackoverflow.com/questions/57575516/ios13-provisional-location-permission

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