定位,虚拟键盘,推送有问题
1、不能定位
打勾 设置- 隐私-定位服务-你的app-使用应用程序期间(始终)
打开app再进设置后会发现,你打勾的使用程序期间(始终)又给取消了。。。。
原来iOS8需要一些方法。。。
如果需要仅在前台定位,你在调用startUpdatingLocation 前需要调用requestWhenInUseAuthorization
如果需要在前后台定位,你在调用startUpdatingLocation 前需要调用requestAlwaysAuthorization
同时在plist文件中添加ç或NSLocationAlwaysUsageDescription字段,值写"需要定位"就可以了,也可以是其他的,这个提示文字"需要定位"在询问用户授权的时候会显示到的。
1.if ([[[UIDevice
currentDevice] systemVersion] floatValue] >= 8.0) {2.[_locationManager
requestWhenInUseAuthorization ];3.}4. 5.[_locationManager
startUpdatingLocation];
2、模拟器键盘不管用
iOS Simulator- Hardware- keyboard 取消打勾 connect hardware keyboard
3、推送不管用
01.if ([[[UIDevice
currentDevice] systemVersion] floatValue] >= 8.0) {02.[app
registerForRemoteNotifications];03. 04.UIUserNotificationSettings
*settings = [UIUserNotificationSettings settingsForTypes:05.UIRemoteNotificationTypeAlert06.|
UIRemoteNotificationTypeBadge07.|
UIRemoteNotificationTypeSound categories:nil];08.[app
registerUserNotificationSettings:settings];09. 10.} else {11.[app
registerForRemoteNotificationTypes:12.UIRemoteNotificationTypeAlert13.|
UIRemoteNotificationTypeBadge14.|
UIRemoteNotificationTypeSound];15.}版权声明:本文为博主原创文章,未经博主允许不得转载。

浙公网安备 33010602011771号