iOS8 遇到的问题

来源:互联网 发布:知识管理 知乎 编辑:程序博客网 时间:2024/04/29 16:09

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];    }

5 0
原创粉丝点击