iOS8 遇到的与旧版本不同的问题
https://www.2cto.com/kf/201409/336666.html
1、不能定位
打勾 设置- 隐私-定位服务-你的app-使用应用程序期间(始终)
打开app再进设置后会发现,你打勾的使用程序期间(始终)又给取消了。。。。
原来iOS8需要一些方法。。。
如果需要仅在前台定位,你在调用startUpdatingLocation 前需要调用requestWhenInUseAuthorization
如果需要在前后台定位,你在调用startUpdatingLocation 前需要调用requestAlwaysAuthorization
同时在plist文件中添加NSLocationWhenInUseUsageDescription或NSLocationAlwaysUsageDescription字段,值写"需要定位"就可以了,也可以是其他的,这个提示文字"需要定位"在询问用户授权的时候会显示到的。
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[_locationManager requestWhenInUseAuthorization ];
}
[_locationManager startUpdatingLocation];
2、模拟器键盘不管用
iOS Simulator- Hardware- keyboard 取消打勾 connect hardware keyboard
3、推送不管用
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[app registerForRemoteNotifications];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
UIRemoteNotificationTypeAlert
| UIRemoteNotificationTypeBadge
| UIRemoteNotificationTypeSound categories:nil];
[app registerUserNotificationSettings:settings];
} else{
[app registerForRemoteNotificationTypes:
UIRemoteNotificationTypeAlert
| UIRemoteNotificationTypeBadge
| UIRemoteNotificationTypeSound];
}
评论