Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
337 views
in Technique[技术] by (71.8m points)

ios - iOS13 Provisional Location Permission

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...