天天看点

ios8问题总结

1、不能定位

打勾 设置- 隐私-定位服务-你的app-使用应用程序期间(始终)

打开app再进设置后会发现,你打勾的使用程序期间(始终)又给取消了。。。。

原来iOS8需要一些方法。。。

如果需要仅在前台定位,你在调用startUpdatingLocation 前需要调用requestWhenInUseAuthorization

如果需要在前后台定位,你在调用startUpdatingLocation 前需要调用requestAlwaysAuthorization

同时在plist文件中添加NSLocationWhenInUseUsageDescription或NSLocationAlwaysUsageDescription字段,值写"需要定位"就可以了,也可以是其他的,这个提示文字"需要定位"在询问用户授权的时候会显示到的。

?

1 2 3 4 5

if

([[[UIDevice currentDevice] systemVersion] floatValue] >=

8.0

) {

[_locationManager requestWhenInUseAuthorization ];

}

[_locationManager startUpdatingLocation];

2、模拟器键盘不管用

iOS Simulator- Hardware- keyboard 取消打勾 connect hardware keyboard

3、推送不管用

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

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

}