前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >XCode14 & iOS16 适配问题汇总

XCode14 & iOS16 适配问题汇总

作者头像
傅_hc
发布2022-10-31 11:30:45
2.9K0
发布2022-10-31 11:30:45
举报
文章被收录于专栏:iOS开发随笔iOS开发随笔

1、不升级电脑系统与 Xcode,调试iOS 16

  • 1、下载iOS16 Support文件
  • 2、放置到Xcode DeviceSupport目录重启Xcode即可/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

2、iOS16手机开启开发者模式

iOS16手机未打开开发者模式时: 1、Xcode 无法选中 iOS16的设备,报错:developer mode disable 2、无法打开升级前编译的App

解决办法:打开调试手机-设置-隐私与安全-开发者模式-开启开发者模式(需要重启手机)

3、Pod工程中的Bundle target签名报错

  • 方法一:手动选择Pod工程中的Bundle target 签名中的Team,与主工程一致
  • 方法二:在Podfile脚本中设置你的开发者的Team ID
代码语言:javascript
复制
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings["DEVELOPMENT_TEAM"] = "Your Team ID"
         end
    end
  end
end

方法三:在Podfile脚本中设置CODE_SIGN_IDENTITY为空来避免报错,这是目前在用的,也是最简单的方法

代码语言:javascript
复制
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CODE_SIGN_IDENTITY'] = ''
         end
    end
  end
end

4、iOS16 横竖屏切换适配

5、Xcode14运行项目在模拟器上报如下错误:

代码语言:javascript
复制
Thread 1: "[<_UINavigationBarContentViewLayout 0x7fd1a090d730> valueForUndefinedKey:]: this class is not key value coding-compliant for the key inlineTitleView."

打开全局断点就会出现这个报错,虽然不会闪退,但是很影响调试,是Xcode的bug,但是还没有修复,找到两个比较好的办法:

  • 方法一:在全局断点上添加下面的条件
代码语言:javascript
复制
!(BOOL)[(id)[$arg1 reason] containsString:@"_UINavigationBarContentViewLayout"]
  • 方法二:添加下面代码到工程,并在启动之后马上调用
代码语言:javascript
复制
#import <objc/runtime.h>

@interface Xcode14Fixer : NSObject
@end

@implementation Xcode14Fixer

+ (void)load
{
    Class cls = NSClassFromString(@"_UINavigationBarContentViewLayout");
    SEL selector = @selector(valueForUndefinedKey:);
    Method impMethod = class_getInstanceMethod([self class], selector);

    if (impMethod) {
        class_addMethod(cls, selector, method_getImplementation(impMethod), method_getTypeEncoding(impMethod));
    }
}

- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}

@end

参考: Xcode 14 Beta 5 throws an exception

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-07-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、不升级电脑系统与 Xcode,调试iOS 16
  • 2、iOS16手机开启开发者模式
  • 3、Pod工程中的Bundle target签名报错
  • 4、iOS16 横竖屏切换适配
  • 5、Xcode14运行项目在模拟器上报如下错误:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档