Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 如何在Mac上注册“使用位置的应用程序”_Macos_Core Location - Fatal编程技术网

Macos 如何在Mac上注册“使用位置的应用程序”

Macos 如何在Mac上注册“使用位置的应用程序”,macos,core-location,Macos,Core Location,我在Mac上玩Wi-Fi定位系统WPS 尝试指定可能的最精确定位。我注意到,像“地图”这样的应用程序在操作系统的位置通知中注册 但我的代码似乎并没有产生这种效果 - (void)startStandardUpdates { // Create the location manager if this object does not // already have one. if (nil == locationManager) locationManage

我在Mac上玩Wi-Fi定位系统WPS

尝试指定可能的最精确定位。我注意到,像“地图”这样的应用程序在操作系统的位置通知中注册

但我的代码似乎并没有产生这种效果

- (void)startStandardUpdates
{
    // Create the location manager if this object does not
    // already have one.
    if (nil == locationManager)
        locationManager = [[CLLocationManager alloc] init];

    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;

    // Set a movement threshold for new events.
    locationManager.distanceFilter = 1; // meters

    [locationManager startUpdatingLocation];
}
我遗漏了什么吗?

你的应用程序沙盒了吗? 如果是,您需要在目标的“功能”选项卡中启用应用程序数据->位置权限。 否则,CLLocationManager无法以静默方式启动

另一个有趣的点是,只有当CLLocationManager实际运行时,您的应用程序才会显示在此列表中。调用StopUpdateLocation将从location agent注销您的应用程序

使用核心位置的OS X应用程序的最小授权文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.personal-information.location</key>
    <true/>
</dict>
</plist>

你好,weichsel,我是从Xcode运行的。我是否也需要从开发环境中“沙箱”我的应用程序?有趣的是,location manager能够报告正确的lat,lng,我只是想知道它是否是最“准确的”,因为没有注册“使用位置的应用程序”。对我来说,核心位置只是在启用沙箱而未指定com.apple.security.personal-information.location权限时默默失败。当沙箱根本没有启用时,CL工作正常。你是如何获得纬度的?CLManager是否正在调用您的代理方法,例如locationManager:manager:DidUpdateLocation:Yes,2014-03-28 14:17:27.119 AirTest[84749:303]locationManager:didUpdateLocations“+/-65.00m速度-1.00 mps/航程-1.00@3/28/14,2:17:27以色列夏令时我现在也学习了沙箱。我的应用程序目前没有沙箱。我注意到大多数应用程序条目,包括Maps.app,在一段时间后从菜单图标消失。即使应用程序仍在运行并报告位置数据。图标是什么在你启动应用程序后显示,还是根本没有显示?一点也没有。地图会消失,因为它会对位置数据进行小范围的轮询。如果你将应用程序放回焦点,它会再次出现,因为它试图再次对你的当前位置进行三角测量。这就是“蓝点”的原因在应用程序打开并处于焦点一段时间后出现。