最佳答案
另一种设置位置的方法是通过混合“CLLocationManager”类的“位置”。在 obj-c 中,
+(void) load {
// replace 'location' with 'custom_location' method
}
然后通过简单地更改“kMockedLatitude”和“kMockedLongitude”变量,使用您想要设置的任何位置实现 custom_location 方法。
//Portland, USA
CLLocationDegrees kMockedLatitude = 45.52306;
CLLocationDegrees kMockedLongitude = -122.67648;
-(CLLocation *)custom_location
{
return [[CLLocation alloc] initWithLatitude:kMockedLatitude longitude:kMockedLongitude];
}
这甚至可以在 iOS 设备上使用。
关于ios - 在运行时设置位置模拟器 City/GPX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38352453/