简体   繁体   English

iOS13 临时位置权限

[英]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/如果你看到 WWDC 视频: 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"".这家伙在 04:14 明确说,“你要求 requestAlwaysAuthorization,苹果为你提供了“使用时”的最大选项,但同时委托回调说,该应用程序具有“始终允许权限””。 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.在 04:35,他说,启动地理围栏活动作为后台跟踪/始终允许的要求。 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.在 05:22,固定临时始终允许权限的弹出窗口仅出现(在操作系统方便时),当您锁定设备并解锁它时,如上段所述将其置于后台之后。 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.这似乎非常无用。

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.他以此作为使用 Always 权力的例子。 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.在 05:22,固定临时始终允许权限的弹出窗口仅出现(在操作系统方便时),当您锁定设备并解锁它时,如上段所述将其置于后台之后。 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.如果用户现在接受 Always,则传递保留的委托消息。

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.但是,您似乎不需要它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM