返回Mapkit Userlocation坐标

rso*_*son 1 iphone mapkit

每当我尝试返回当前位置的纬度/经度坐标时,我的应用程序崩溃,没有解释错误...

NSLog(@"%@", mapView.userLocation.location.coordinate);
Run Code Online (Sandbox Code Playgroud)

我等到电话找到了位置......

Ole*_*ann 5

mapView.userLocation.location.coordinate是一个结构,而%@格式说明符期望一个对象.这将有效:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);
Run Code Online (Sandbox Code Playgroud)