升级xcode9 ios11遇到的问题及解决办法
1. 导航栏titleView适配问题

导航栏搜索视图没有占满导航栏 iOS11 导航栏上的视图推荐使用autolayout 。所以那些出问题的最好修改一下布局方式。
解决这个问题的方法就是重写searchbar的intrinsicContentSize方法 给他指定宽高大小
- (CGSize)intrinsicContentSize{
returnCGSizeMake(ScreenWidth,31);
}
Intrinsic Contenet Size – Intrinsic Content Size:固有大小。顾名思义,在AutoLayout中,它作为UIView的属性(不是语法上的属性),意思就是说我知道自己的大小,如果你没有为我指定大小,我就按照这个大小来。 比如:大家都知道在使用AutoLayout的时候,UILabel是不用指定尺寸大小的,只需指定位置即可,就是因为,只要确定了文字内容,字体等信息,它自己就能计算出大小来。


ios 11的UISearchBar高度变了 变成56了 以前是44
CGFloat height =44;
if(@available(iOS 11.0, *)) {
height =56;
}
CCSearchBar*mysearchBar = [[CCSearchBaralloc]initWithFrame:CGRectMake(0,0,ScreenWidth, height)];
2 .导航栏遇到的第二个问题:导航栏上的头像 变形

原因是我用的
UIBarButtonItem*leftBarButtonItem = [[UIBarButtonItemalloc] initWithCustomView:personalButton];
这种方式 personalButton用的是frame布局 给他增加一个宽高的约束就可以了
NSLayoutConstraint*widthConstraint = [NSLayoutConstraintconstraintWithItem:personalButtonattribute:NSLayoutAttributeWidthrelatedBy:NSLayoutRelationEqualtoItem:nilattribute:NSLayoutAttributeNotAnAttributemultiplier:0.0constant:30];
[personalButtonaddConstraint:widthConstraint];
NSLayoutConstraint*heightConstraint = [NSLayoutConstraintconstraintWithItem:personalButtonattribute:NSLayoutAttributeHeightrelatedBy:NSLayoutRelationEqualtoItem:nilattribute:NSLayoutAttributeNotAnAttributemultiplier:0.0constant:30];
[personalButtonaddConstraint:heightConstraint];
3.SimplePing编译不过的问题

由于iOS

framework 里面改了一下这句代码的定义 只需要把 check_compile_time 这个函数改成 __Check_Compile_Time 就行了 这两个函数是一样的 。
check_compile_time(sizeof(IPHeader) ==20);
将所有的check_compile_time改为__Check_Compile_Time:
__Check_Compile_Time(sizeof(IPHeader) ==20);

3. Xcode9下相册等访问权限崩溃问题
查了资料说iOS11下,苹果对相册的权限key做了调整,原来的NSPhotoLibraryUsageDescription,在iOS11之后,改成了NSPhotoLibraryAddUsageDescription。
所以你可以在info.plist 把 key 改成NSPhotoLibraryAddUsageDescription, 很快解决问题了.