问题描述:皮肤商店-自定义主题中有个拍照功能,iOS 8.1下旋转后需要歪脖子观看。
问题分析:UIImagePickerController在iOS 8.0中,不会随设备旋转。同事手动旋转来修复了这个bug。
8.1中,Apple修复了以上的这个bug。但是手动代码还是执行了,导致到了一次旋转。
问题解决:对8.0做特殊化处理:只有在8.0中采用手动旋转
问题描述:皮肤商店-自定义主题中有个拍照功能,iOS 8.1下旋转后需要歪脖子观看。
问题分析:UIImagePickerController在iOS 8.0中,不会随设备旋转。同事手动旋转来修复了这个bug。
8.1中,Apple修复了以上的这个bug。但是手动代码还是执行了,导致到了一次旋转。
问题解决:对8.0做特殊化处理:只有在8.0中采用手动旋转
问题描述:
在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
问题描述:输入法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
问题描述:Xcode beta4的Array从
[]改成了
这种用法。然后定义成
,报错如下:
Immutable value of type only has mutating members named 'append'
问题分析:可空符号其实是一层封装,使用时实际上需要压包和解包。使Array变成了let。可能是Xcode的一个bug。
暂时先去除!,这样用:
问题描述:推送使用的是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中调用-[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
回调中
问题描述:今天让设置项适配iPad,用[tableView: viewForHeaderInSection:]函数自定义UITableView的Header,发现第一个Header没有显示。
问题解决:
原因是没有给[tableView: viewForHeaderInSection:]返回UIView设置高度。
并且也没有通过-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section指定高度。
前面2个原因实现一个便可以显示出第一个Header。
问题描述:在Xcode6 beta2中使用[extensionContext openURL: completionHandler:]无效
问题分析:查看xcode6 beta2 realse note,发现xcode这版openURL在extension不可用
• openURL does not work from an 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
from debugger: Terminated due to signal 9" (17303593)!
PS:重启电脑和真机都无法解决此问题,上午坏了,下午莫名好了,用了一会又坏了
问题描述:Xcode对如下代码
result= point1
报如下错误
Prefix/postfix '=' is reserved
问题解决:Swift对=前后有空格会认为是保留运算附,改为
result=point1