Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.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
Objective c MKMapView不显示当前位置,或者更确切地说,不显示任何位置(在模拟器中)_Objective C_Mapkit_Core Location - Fatal编程技术网

Objective c MKMapView不显示当前位置,或者更确切地说,不显示任何位置(在模拟器中)

Objective c MKMapView不显示当前位置,或者更确切地说,不显示任何位置(在模拟器中),objective-c,mapkit,core-location,Objective C,Mapkit,Core Location,我有一个MKMapView,它的委托设置为我的控制器(m)类 代码如下: -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Create location manager object locationManager = [[CLLocationManager alloc] init]; // Make

我有一个MKMapView,它的委托设置为我的控制器(m)类

代码如下:

-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Create location manager object
    locationManager = [[CLLocationManager alloc] init];

    // Make this instance of WhereamiAppDelegate the delegate
    // it will send its messages to our WhereamiApplDelegate
    [locationManager setDelegate:self];

    // We want all results from the location manager
    [locationManager setDistanceFilter:kCLDistanceFilterNone];

    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [mapView setShowsUserLocation:YES];

    [window makeKeyAndVisible];
    return YES;

}
然而,我看到的只是一张没有蓝色注释点的世界地图?

模拟器“真的”不支持这一点。如果你绕过足够多的检查,它将显示苹果的总部。任何GPS测试都需要一个真正的设备

编辑:我相信你可以删除一个pin码,它会显示出来,但是对于从CLLocationManager(通过CLLocationManagerDelegate)的回调,它不会在模拟器中发生;至少是最近的。在3.0之前我什么都不能说

self.mapview.mapType = MKMapTypeStandard;
    self.mapview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.mapview.showsUserLocation = YES;
如果你有一个指向地图的名为mapView的指针,这就是你所需要的,但正如Merky所说,你需要一个真正的设备。但是,您可以做的是,当模拟器运行时,转到“调试->位置->自己的位置”,并输入所需坐标的坐标