我想检查iOS设备的版本是否大于3.1.3
我尝试过的东西:
[[UIDevice currentDevice].systemVersion floatValue]
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我只想要一个:
if (version > 3.1.3) { }
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我正在寻找一种方法来确定用户是否通过设置启用或禁用了我的应用程序的推送通知.
我有一个带有地图和按钮的视图(比如地图应用程序一次),允许用户在地图上居中和缩放他当前的位置.如果我不能使用locationServicesEnabled方法(总是返回YES),我应该创建一个BOOL属性来检查是否调用了didFailWithError方法并知道我是否可以调用button方法?
谢谢阅读.
编辑:
此代码对我不起作用.我正在使用模拟器.在询问locationServicesEnabled时,我总是得到YES.
// Gets the user present location.
- (IBAction)locateUser:(id)sender {
if([CLLocationManager locationServicesEnabled]) {
CLLocationCoordinate2D coordinate;
coordinate.latitude = self.mapView.userLocation.location.coordinate.latitude;
coordinate.longitude = self.mapView.userLocation.location.coordinate.longitude;
[self zoomCoordinate:coordinate];
} else {
[[[[UIAlertView alloc] initWithTitle:@"Warning." message:@"Location services are disabled."
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease] show];
}
}
Run Code Online (Sandbox Code Playgroud)