美文网首页
iOS 12系统适配及iPhone X系列屏幕适配

iOS 12系统适配及iPhone X系列屏幕适配

作者: 子懿黎昕 | 来源:发表于2018-11-16 11:39 被阅读0次

适配iOS 12

重复文件info.plist

前些天从Xcode 9升级到Xcode 10,然后开始做iOS 12的适配工作。安装完毕之后开始build项目,然后报错,报错的信息Mutiple commands produce 'XXXXX/Info.plist':说是有重复的info.plist。

info.plist重复

按照错误提示信息删除多余的info.plist。

library not found for  -lstdc++.6.0.9

libstdc++库找不到

接着build,然后报错找不到C++.6.0.9库。原因是苹果在Xcode 10中移除了libstdc++这个库,由libc++这个库代替。libstdc++这个库已经被标记为废弃有5年了,苹果建议使用经过LLVM优化过并且全面支持C++11的libc++库。

临时解决办法:

从Xcode9中拷贝出libstdc++库加入到Xcode 10中,使用如下命令行

cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/

cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

如果电脑上没有可用的Xcode 9 也可以参考Xcode 10中删除的libstdc++库,这个github里面有对应的libstdc++库

libstdc++库

正确的解决方法:

如果是自己的业务模块使用了libstdc++,需要把模块代码调整为依赖libc++,如果是引用了的第三方库使用了libstdc++,那么向第三方库寻求升级支持。

适配iPhone X系列屏幕

如果项目使用的是LaunchScreen.storyboard,下面的内容的不适用,如果使用的是LaunchImage,就需要让UI设计师提供正确的切图

启动页需要尺寸

添加启动图时需要注意的是要确保iOS 8.0 and Later下面的iPhone勾选

勾选iOS8.0 and Later

补充:

如果项目里面是使用的64,49这种数字形式排版UI界面的需要注意,需要针对iPhone X系列做一些调整,以适配刘海和触控条。

#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height#define kTopHeight 44.0#define kNavigationBarHeight (kStatusBarHeight + kTopHeight)#define kTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)#define IS_IPHONEX ([[UIScreen mainScreen] bounds].size.height == 812 || [[UIScreen mainScreen] bounds].size.height == 896)

相关文章

网友评论

      本文标题:iOS 12系统适配及iPhone X系列屏幕适配

      本文链接:https://www.haomeiwen.com/subject/gpypfqtx.html