【问题标题】:Delay app until the user allows or disallows current location延迟应用,直到用户允许或禁止当前位置
【发布时间】:2013-11-26 18:05:06
【问题描述】:

有没有办法在用户回答当前位置提示之前延迟代码运行?我的应用程序获取注释并将它们放在地图上。当应用程序第一次启动并且用户允许当前位置时,它无法获取任何注释,因为代码已经运行但没有接收到当前位置。提前致谢。

【问题讨论】:

    标签: ios core-location currentlocation


    【解决方案1】:

    您可以实现以下CLLocationManagerDelegatemethod

    - (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
    

    并且仅在调用该方法后显示您的注释。当用户接受或拒绝当前位置提示时会调用它。

    【讨论】:

    • 这样就完成了!要是我在我的应用上架之前问过就好了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-10
    • 2014-08-18
    • 2019-11-03
    • 2013-03-15
    相关资源
    最近更新 更多