草庐IT

XCode14 & iOS16 适配

遇雪纷纷 2023-03-28 原文

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

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

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

方法一:手动选择Pod工程中的Bundle target 签名中的Team,与主工程一致

方法二:在Podfile脚本中设置你的开发者的Team ID

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为空来避免报错

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. UICalendarView

新增 UICalendarView,可以显示日期并支持单选与多选日期

5. UIPasteControl

新增 UIPasteControl 用于读取剪贴板中的内容,否则跨 App 读取时会弹出对话框让用户进行选择是否同意

6. UIEditMenuInteraction

新增一个交互 UIEditMenuInteraction,用于取代 UIMenuController 与 UIMenuItem。

7.UIFindInteraction

新增一个交互 UIFindInteraction 用于文本内容查找与替换。

8. LARightStore

LARightStore 用于存储与获取 keychain 中的数据。

9.UIImage

UIImage 增加了新的构造函数用于支持 SF Symbols 最新版中增加的类别 Variable。

10.UIPageControl

UIPageControl 支持垂直显示并可以设置指示器与当前页的图片

11.UITableView , UICollectionView

1.UITableView 与 UICollectionView 在使用 Cell Content Configuration 时支持使用 UIHostingConfiguration 包装 SwiftUI 代码定义 Cell 的内容。

cell.contentConfiguration = UIHostingConfiguration {

    HStack {

        Image(systemName: images[indexPath.row])

            .foregroundStyle(.teal)

        Text(devices[indexPath.row])

            .font(.caption)

            .foregroundStyle(.secondary)

    }

}

2.UITableView 与 UICollectionView 增加了新的selfSizingInvalidation参数,通过它 Cell 具备自动调整大小的能力。

12.UINavigationItem

UINavigationItem 增加了一个属性style用于描述 UINavigationItem 在 UINavigationBar 上的布局;增加了一个属性backAction用于实现当前 UIViewController 的返回按钮事件;增加了一个属性titleMenuProvider用于给当前导航栏的标题添加操作菜单。

13.UISheetPresentationController

UISheetPresentationController 支持自定义显示的 UIViewController 的大小

14.UIMenu 支持设置尺寸,分别为small、medium与large。

let addNewMenu = UIMenu(title: "", preferredElementSize: .small, children: menuActions)

15.隐私权限增强

隐私权限增强,如通过 UIDevice 获取设备名称时,无法获取用户的信息,只能获取设备对应的名称。

16.UIDevice

UIDevice 不再支持通过setValue()方法设置设备的方向,替换为 UIWindowScene 的requestGeometryUpdate()方法。

17. Live Activity

支持 Live Activity,可以理解为一种特殊的锁屏界面显示的 Widget。

18.UIFont

增加了 3 种新的宽度样式:compressed、condensed与expanded,加上默认的standard,目前 UIFont 共有 4 种字体宽度。宽度大小关系为:expanded>standard>condensed>compressed

//  Created by YungFanimportUIKitclassViewController:UIViewController{// 定义4种宽度不同的字体let expanded =UIFont.systemFont(ofSize:27, weight:.bold, width:.expanded)let standard =UIFont.systemFont(ofSize:27, weight:.bold, width:.standard)let condensed =UIFont.systemFont(ofSize:27, weight:.bold, width:.condensed)let compressed =UIFont.systemFont(ofSize:27, weight:.bold, width:.compressed)lazyvar expandedLabel:UILabel={let label =UILabel(frame:CGRect(x:10, y:100, width:360, height:40))

        label.text ="Xcode14 and iOS16"

        label.font = expanded

        return label

    }()lazyvar standardLabel:UILabel={let label =UILabel(frame:CGRect(x:10, y:150, width:360, height:40))

        label.text ="Xcode14 and iOS16"

        label.font = standard

        return label

    }()lazyvar condensedLabel:UILabel={let label =UILabel(frame:CGRect(x:10, y:200, width:360, height:40))

        label.text ="Xcode14 and iOS16"

        label.font = condensed

        return label

    }()lazyvar compressedLabel:UILabel={let label =UILabel(frame:CGRect(x:10, y:250, width:360, height:40))

        label.text ="Xcode14 and iOS16"

        label.font = compressed

        return label

    }()overridefuncviewDidLoad(){super.viewDidLoad()

        view.addSubview(expandedLabel)

        view.addSubview(standardLabel)

        view.addSubview(condensedLabel)

        view.addSubview(compressedLabel)}}

每个更新点的具体变化案例可参考https://www.jianshu.com/nb/49167696

有关XCode14 & iOS16 适配的更多相关文章

  1. ruby - 如何在 Lion 上安装 Xcode 4.6,需要用 RVM 升级 ruby - 2

    我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121

  2. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  3. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

  4. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  5. 在VMware16虚拟机安装Ubuntu详细教程 - 2

    在VMware16.2.4安装Ubuntu一、安装VMware1.打开VMwareWorkstationPro官网,点击即可进入。2.进入后向下滑动找到Workstation16ProforWindows,点击立即下载。3.下载完成,文件大小615MB,如下图:4.鼠标右击,以管理员身份运行。5.点击下一步6.勾选条款,点击下一步7.先勾选,再点击下一步8.去掉勾选,点击下一步9.点击下一步10.点击安装11.点击许可证12.在百度上搜索VM16许可证,复制填入,然后点击输入即可,亲测有效。13.点击完成14.重启系统,点击是15.双击VMwareWorkstationPro图标,进入虚拟机主

  6. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  7. ruby-on-rails - 无法安装 mysql2 0.3.14 gem - 2

    我看到其他人也遇到过类似的问题,但没有一个解决方案对我有用。0.3.14gem与其他gem文件一起存在。我已经完全按照此处指示完成了所有操作:https://github.com/brianmario/mysql2.我仍然得到以下信息。我不知道为什么安装程序指示它找不到include目录,因为我已经检查过它存在。thread.h文件存在,但不在ruby​​目录中。相反,它在这里:C:\RailsInstaller\DevKit\lib\perl5\5.8\msys\CORE\我正在运行Windows7并尝试在Aptana3中构建我的Rails项目。我的Ruby是1.9.3。$gemin

  8. ruby - 在 Ubuntu 14.04 中使用 Curl 安装 RVM 时出错 - 2

    我试图在Ubuntu14.04中使用Curl安装RVM。我运行了以下命令:\curl-sSLhttps://get.rvm.io|bash-sstable出现如下错误:curl:(7)Failedtoconnecttoget.rvm.ioport80:Networkisunreachable非常感谢解决此问题的任何帮助。谢谢 最佳答案 在执行curl之前尝试这个:echoipv4>>~/.curlrc 关于ruby-在Ubuntu14.04中使用Curl安装RVM时出错,我们在Stack

  9. ruby - gem install pg error : couldn't understand kern. osversion `14.0.0' on Yosemite w/Ruby 2.1.5 - 2

    我使用RVM安装Ruby-2.1.5并再次运行bundle。现在pggem不会安装,我得到这个错误:geminstallpg-v'0.17.1'----with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_configBuildingnativeextensionswith:'--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config'Thiscouldtakeawhile...ERROR:Error

  10. ruby-on-rails - Ubuntu 14.04 Rails 丢失文件 - 2

    安装Rails时,一切都很好,但后来,我写道:rails-v和输出:/home/toshiba/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in`require':cannotloadsuchfile--rails/cli(LoadError)from/home/toshiba/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in`r

随机推荐