我试图获取用户当前位置。这是我的代码:
-(CLLocationCoordinate2D) getLocation{
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
CLLocation *location = [locationManager location];
CLLocationCoordinate2D coordinate = [location coordinate];
return coordinate;
}
这就是我在viewDidLoad中调用它的地方
CLLocationCoordinate2D coordinate = [self getLocation];
double latitude = coordinate.latitude;
double longitude = coordinate.longitude;
并且纬度和经度都返回0.000000。 请帮忙!我正在使用Xcode 8并在我真正的iPhone 6s而不是仿真器上运行。
答案 0 :(得分:3)
您可以使用此代码:
<!-- Game Timer Element -->
<div id="Game_Elements" style="display:none; position:absolute; z-index:7; top:0px; left:0px; width: 1920px; heigth: 1080px; margin:auto;">
<table id="Game_Timer_Element">
<tr>
<td>
<div id="Game_Minute_timer" style="z-index:50; position:absolute; top:440px; left:850px; font-size:160px; font-family:'Avenir'; width:1080; color:#fff;">
<font face="Avenir"></font>
</div>
</td>
<td>
<div id="Game_Second_timer" style="z-index:50; position:absolute; top:440px; left:1195px; font-size:160px; font-family:'Avenir'; width:1080; color:#fff;">
<font face="Avenir"></font>
</div>
</td>
</tr>
</table>
</div>