定位,虚拟键盘,推送有问题

来源:互联网 发布:mac os 系统清理 编辑:程序博客网 时间:2024/04/30 15:34
1、不能定位
打勾 设置- 隐私-定位服务-你的app-使用应用程序期间(始终)
打开app再进设置后会发现,你打勾的使用程序期间(始终)又给取消了。。。。


原来iOS8需要一些方法。。。
如果需要仅在前台定位,你在调用startUpdatingLocation 前需要调用requestWhenInUseAuthorization
如果需要在前后台定位,你在调用startUpdatingLocation 前需要调用requestAlwaysAuthorization
同时在plist文件中添加ç或NSLocationAlwaysUsageDescription字段,值写"需要定位"就可以了,也可以是其他的,这个提示文字"需要定位"在询问用户授权的时候会显示到的。

view sourceprint?
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、推送不管用


view sourceprint?
01.if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
02.[app registerForRemoteNotifications];
03. 
04.UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
05.UIRemoteNotificationTypeAlert
06.| UIRemoteNotificationTypeBadge
07.| UIRemoteNotificationTypeSound categories:nil];
08.[app registerUserNotificationSettings:settings];
09. 
10.else {
11.[app registerForRemoteNotificationTypes:
12.UIRemoteNotificationTypeAlert
13.| UIRemoteNotificationTypeBadge
14.| UIRemoteNotificationTypeSound];
15.}


0 0
原创粉丝点击