Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.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
位置更新在iPhone 5(iOS 7)中不起作用,但在模拟器中起作用_Ios_Iphone_Ios7_Cllocationmanager - Fatal编程技术网

位置更新在iPhone 5(iOS 7)中不起作用,但在模拟器中起作用

位置更新在iPhone 5(iOS 7)中不起作用,但在模拟器中起作用,ios,iphone,ios7,cllocationmanager,Ios,Iphone,Ios7,Cllocationmanager,我的iPhone中的后台定位服务有问题。所以,我决定在我的设备上测试前台服务。最好的事情是,即使它没有工作 - (IBAction) btnPressed { [self startStandardUpdates] } - (void)startStandardUpdates { if (nil == self.manager) { [CLLocationManager locationServicesEnabled]; self.mana

我的iPhone中的后台定位服务有问题。所以,我决定在我的设备上测试前台服务。最好的事情是,即使它没有工作

- (IBAction) btnPressed
 {
     [self startStandardUpdates]
 }
- (void)startStandardUpdates
{

    if (nil == self.manager) {
        [CLLocationManager locationServicesEnabled];
        self.manager = [[CLLocationManager alloc] init];
        self.manager.delegate = self;
        self.manager.desiredAccuracy = kCLLocationAccuracyBest;
        self.manager.pausesLocationUpdatesAutomatically = NO;
        [self.manager startUpdatingLocation];
   }
}

- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
    NSLog(@"Paused");
}

- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
   NSLog(@"Resumed");
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    NSLog(@"Error : %@", error);
}

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    NSLog(@"Locations : %@",locations);

}

显示三个更新后,它停止。和
-(void)LocationManager或dPauseLocationUpdate:(CLLocationManager*)manager
永远不会被调用,因为“暂停”永远不会注销。

设备是否静止不动?如果是这样的话,我认为一旦确定设备没有移动超过指定半径,核心位置将根据您所需的精度停止发射。无需纠正。

您正在运营商网络中尝试吗?模拟器工作速度很快。但设备上的一些问题是设备静止不动吗?您所需的定位精度可能会导致它在确定设备没有移动后停止发射。@CliffRibaudo设备确实是静止的。我也检查了最准确的代码。它仍然会停止。固定设备的“最佳”精度不会改变任何东西,设备仍然是固定的。。。除非你试图检测振动,这是:)模拟器为你伪造的。如果它在那里起作用,它可能会起作用。也。。。选择您可以接受的最粗粒度,以避免浪费电池。@CliffRibaudo我这样做只是为了好玩……您能分享您的答案的参考资料吗。我只是想确定一下。那么我会接受你的回答我没有任何参考资料。。。就在iOS编程的最后7年:)如果你想了解为什么我可能知道我在说什么,请查看我的个人资料。。。。此外,还有核心位置的iOS文档,您可以检查以验证。7年。。。你已经看到历史正在被创造。。。另外,如果你能给我你的电子邮件或其他东西也会很好。我相信你能帮我很多忙