hidesBottomBarWhenPushed 黑影bug

问题描述:
在storyboard中勾选UIViewController的Hide Bottom Bar On Push属性,或者设置UIViewController的hidesBottomBarWhenPushed为YES。然后进行UINavigationController的push操作。切换ViewController时,导航栏右边会出现黑色类似阴影的东西。
问题分析:
此为iOS的bug,只能绕开hidesBottomBarWhenPushed。
问题解决:
可以通过在代码中控制UITabBarController的tabBar的hidden属性来隐藏bottom bar。
在需要隐藏的ViewController的ViewWillAppear中,将其设置为YES;在需要显示的VewController的ViewWillAppear中,将其设置为NO.

PS: under iOS8, Xcode beta6 GM

iOS8 Extension中横竖屏Notification问题

问题描述:输入法Extension中使用Notification监听UIApplicationDidChangeStatusBarOrientationNotification,发现userInfo中返回转屏前方向

问题分析:使用self.interfaceOrientation发现同样返回的是转屏前方向。查了下文档,发现:

UIApplicationWillChangeStatusBarOrientationNotification
Posted when the app is about to change the orientation of its interface.

UIApplicationDidChangeStatusBarOrientationNotification
Posted when the orientation of the app’s user interface changes.

问题解决:替换为UIApplicationWillChangeStatusBarOrientationNotification监听事件,返回正常

PS:Xcode6 beta5, iOS8 ,Keyboard Extension

Swift下Array不能使用!可变标记

问题描述:Xcode beta4的Array从

  • var path:CGPath
  • []改成了

  • var path:[CGPath]
  • 这种用法。然后定义成

  • var path:[CGPath]!
  • ,报错如下:
    Immutable value of type only has mutating members named 'append'

    问题分析:可空符号其实是一层封装,使用时实际上需要压包和解包。使Array变成了let。可能是Xcode的一个bug。
    暂时先去除!,这样用:

  • var path:[CGPath]
  • 在App没有运行的情况下通知中心不回调的问题

    问题描述:推送使用的是BPush,并实现了应用内跳转。在App没有运行(包括后台运行)的情况下,点击推送,跳转失效。
    问题分析
    在App没有运行(包括后台运行)的情况下
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    函数不回调的问题

    问题解决
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    在此函数中可以拿到回调数据,然后做处理
    NSDictionary* userInfo=[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if(userInfo)
    {
    [self application:application didReceiveRemoteNotification:userInfo];
    }

    iOS8中设置App红点提示没有权限的问题

    问题描述:在iOS8中调用-[UIApplication setApplicationIconBadgeNumber:]会出现如下没有权限的提示:
    Attempting to badge the application icon but haven't received permission from the user to badge the application
    问题分析
    用如下方法注册通知权限后,App会弹出一个框进行确认。在确认之前或者被否决,都是没有权限设置红点的。
    UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
    iOS8中新增了通知授权后的回调:
    - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
    问题解决
    把所有
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中的-[UIApplication setApplicationIconBadgeNumber:]
    移到
    - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
    回调中

    UITableView第一个Header不显示的问题

    问题描述:今天让设置项适配iPad,用[tableView: viewForHeaderInSection:]函数自定义UITableView的Header,发现第一个Header没有显示。

    问题解决
    原因是没有给[tableView: viewForHeaderInSection:]返回UIView设置高度。
    并且也没有通过-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section指定高度。

    前面2个原因实现一个便可以显示出第一个Header。

    Xcode6 beta2 不能调试extension问题

    问题描述:在用Xcode6 beta2联机调试输入法时出现如下问题
    Message from debugger: Terminated due to signal 9

    问题分析:查看xcode6 beta2 realse note,发现xcode这版不支持extension的调试
    • Debugging Share or Action app extensions does not work in this release. You will see an error
    message similar to: "The app on quit unexpectedly. Message
    from debugger: Terminated due to signal 9" (17303593)!

    PS:重启电脑和真机都无法解决此问题,上午坏了,下午莫名好了,用了一会又坏了