Xcode 27正式发布:系统要求、部署目标,以及哪些东西坏了
Xcode 27于2026年9月14日以构建版本27A266a发布,距信息源中出现iOS 27.0 RC条目仅三天,与iOS 27.0(24A437)、macOS 27.0(26A428)以及其余27系平台同日推出。App Store Connect当天开始接受用27.0 GA SDK构建的版本,而RC SDK构建的版本自9月9日起就已可以上传。15 它要求macOS Tahoe 26.6或更高版本以及Apple silicon Mac,附带Swift 6.4和27系SDK,可调试运行iOS 17或更高版本的设备,并上调了三个最低部署目标:macOS 12、watchOS 9和DriverKit 21。23 对于现有项目,它带来三处必然失败的变化(@State宏、SE-0508造成的源代码兼容性破坏,以及-ld64链接器标志)、一条可能报错的依赖扫描规则、一处对ARCHS_STANDARD的静默更改,还有两条警告。除扫描规则之外,下文的每一项我都在27A266a上实际运行过。246
{.answer-block}
TL;DR
- 日期与构建版本。 Apple的Releases信息源将Xcode 27(27A266a)和全部六个27.0操作系统列在9月14日星期一;其“iOS 27.0 RC (24A437)”条目标注的日期是9月11日星期五,也就是App Store Connect开始接受RC SDK上传两天之后,而GA版沿用同一个构建号。15 App Store Connect自己9月14日的发布说明写明,现在可以上传用Xcode 27构建的App,用于App Store和TestFlight。5
- 系统要求和下限变了。 Xcode 26.6可在macOS 26.2上运行并调试iOS 15设备;Xcode 27需要macOS 26.6,仅在Apple silicon上运行,只能调试iOS 17、tvOS 17和watchOS 10或更高版本,模拟器和真机都是如此。最低部署目标从macOS 11升到12、watchOS 8升到9、DriverKit 20升到21;iOS、iPadOS和tvOS仍为15,visionOS仍为1。23
- 三处必然失败。
@State宏:Apple自己的示例,即在其他存储属性之前给一个带有声明处初始值的@State属性赋值的初始化器,会以variable 'self.title' used before being initialized失败;一个带有数组或字典字面量初始值和init访问器的计算属性,如果getter写在前面就无法编译,Apple将这一源代码兼容性破坏归因于SE-0508;而Xcode 15曾写进文档的-ld64链接器标志,会以ld: library 'd64' not found导致链接失败。2468 - 四处会警告、可能报错或一声不吭的变化。 由于ld64已不复存在,链接器会忽略
-ld_classic并给出警告;同一次依赖扫描中重复的Clang模块名“may report an error”(可能报告错误);设为27.0的纯macOS目标只会构建arm64,除非你把x86_64加回去,而且没有任何警告;PreviewProvider带有27.0的弃用标记,消息是“Use #Preview instead.”,每个预览修饰符也各有自己的替代消息,但在低于27.0的部署目标下,编译器一条都不会显示。24 - 截至9月15日,Apple尚未发布Xcode 27.1。 Releases信息源和发布说明索引都没有列出它,Apple的iPhone Duo开发者页面仍把27.1 beta标注为“later this month”(本月晚些时候);我在Duo开发者文章中描述的SDK空窗期依然存在。1
9月14日发布了什么?
| 项目 | 构建版本 | 信息源日期 |
|---|---|---|
| Xcode 27 | 27A266a | 2026年9月14日,星期一 |
| iOS 27.0 / iPadOS 27.0 | 24A437 | 9月14日,星期一;信息源中的“iOS 27.0 RC (24A437)”条目标注为9月11日星期五,App Store Connect自9月9日星期三起接受RC SDK上传 |
| macOS 27.0 | 26A428 | 9月14日,星期一 |
| tvOS 27.0 | 24J361 | 9月14日,星期一 |
| visionOS 27.0 | 24M362 | 9月14日,星期一 |
| watchOS 27.0 | 24R364 | 9月14日,星期一 |
| App Store Connect | “You can now upload apps built with Xcode 27 using the SDK for iOS 27.0, iPadOS 27.0, macOS 27.0, tvOS 27.0, visionOS 27.0, and watchOS 27.0 for the App Store, and for internal and external testing through TestFlight.”(现在可以上传使用27.0系SDK、由Xcode 27构建的App,用于App Store以及通过TestFlight进行的内部和外部测试) | 9月14日 |
发布说明的Overview写道:“Xcode 27 includes Swift 6.4 and SDKs for iOS 27, iPadOS 27, tvOS 27, watchOS 27, macOS 27, and visionOS 27. Xcode 27 supports on-device debugging in iOS 17 and later, tvOS 17 and later, watchOS 10 and later, and visionOS. Xcode 27 requires a Mac running macOS Tahoe 26.6 or later.”(Xcode 27包含Swift 6.4和各27系SDK,支持在iOS 17及更高版本、tvOS 17及更高版本、watchOS 10及更高版本以及visionOS上进行真机调试,并要求Mac运行macOS Tahoe 26.6或更高版本)2 在这台Mac上,xcodebuild -version输出Xcode 27.0 Build version 27A266a,swift --version输出Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)。4
与26.6相比,Xcode 27有哪些要求?
升级构建机器之前,该查的文档是Apple的兼容性表。两行并排如下:3
| Xcode 26.6 | Xcode 27 | |
|---|---|---|
| 运行所需的macOS | Tahoe 26.2至26.x | Tahoe 26.6或更高版本,仅限Apple silicon2 |
| SDK | iOS、tvOS、watchOS、visionOS、macOS 26.5;DriverKit 25.5 | iOS、tvOS、watchOS、visionOS、macOS 27;DriverKit 27 |
| 部署目标 | iOS 15、tvOS 15、watchOS 8、visionOS 1、macOS 11、DriverKit 20 | iOS 15、tvOS 15、watchOS 9、visionOS 1、macOS 12、DriverKit 21 |
| 可调试的设备 | iOS 15、tvOS 15、watchOS 8、visionOS 1或更高版本 | iOS 17、tvOS 17、watchOS 10、visionOS 1或更高版本 |
| 模拟器 | iOS 15、tvOS 15、watchOS 8、visionOS 1或更高版本 | iOS 17、tvOS 17、watchOS 10、visionOS 1或更高版本 |
| Swift编译器 | 6.3 | 6.4(语言模式6、5、4.2、4) |
这几行背后藏着两个后果。Instruments现在拒绝早于iOS 17、watchOS 10或tvOS 17的设备,所以用一台旧iPhone搭起来的性能分析设备,会在任何App代码出问题之前先停摆。2 而Apple用一句话划定了Device Hub键盘和指针交互的支持范围:“only supported on the following OS versions and newer: macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0.”(仅在以下及更新的系统版本上支持:macOS 15.0、iOS 18.0、tvOS 18.0、watchOS 11.0、visionOS 2.0)2
Apple silicon这项要求,对运行Xcode的那台Mac来说没有任何变通办法;7月读过Intel那篇文章的人对此早已不陌生。GA版说明完整保留了7月的措辞:“Xcode 27 will only install and run on Apple silicon Macs. The macOS 27 SDK supports back deploying Universal (Intel and Apple Silicon) apps to macOS 12 and later. Intel development is still possible with macOS versions that support Rosetta like macOS 27.”(Xcode 27只能安装并运行在Apple silicon Mac上。macOS 27 SDK支持将Universal(Intel和Apple Silicon)App向后部署到macOS 12及更高版本。在macOS 27这类支持Rosetta的macOS版本上,仍可进行面向Intel的开发)2 第三句给出的变通办法,是针对你要发布到的Mac,而不是你用来构建的Mac。
工具链变了什么?
链接器。 GA版说明一句话说完:”The ld64 linker has been removed and the -ld_classic option is no longer supported.”(ld64链接器已被移除,-ld_classic选项不再受支持)2 在27A266a上实际看到的情况是:工具链的usr/bin里只有一个链接器二进制文件ld,它自报为ld-27037.1,构建于2026年8月25日。传入旧标志并不会让链接失败。让hello.c只包含一行int main(void){return 0;},运行clang hello.o -o hello_classic -Xlinker -ld_classic会打印ld: warning: -ld_classic is no longer supported and will be ignored,以退出码0结束并写出可执行文件。Apple在Xcode 15中写进文档的另一种写法-ld64就没这么走运了:8 clang hello.c -o hello_ld64 -Wl,-ld64以ld: library 'd64' not found失败,退出码为1,因为新链接器把-ld64读成了-l d64,也就是请求一个名为d64的库。4 所以,在OTHER_LDFLAGS里保留-ld_classic的项目仍能构建,只是每次链接都多一条新警告,而它从旧链接器那里换来的任何行为都已消失;保留-ld64的项目则会链接失败,而且错误信息从头到尾不提链接器。我的ld64文章追查了这些标志的来源,并记录了两次运行。
默认架构。 Intel Deprecation一节陈述了规则:”Build targets with a min deployment target set to macOS 27.0 or DriverKit 27.0 will not build Universal by default. The ARCHS_STANDARD build setting will no longer include x86_64 when MACOSX_DEPLOYMENT_TARGET or DRIVERKIT_DEPLOYMENT_TARGET >= 27.0.”(最低部署目标设为macOS 27.0或DriverKit 27.0的构建目标,默认不再构建Universal版本。当MACOSX_DEPLOYMENT_TARGET或DRIVERKIT_DEPLOYMENT_TARGET大于等于27.0时,ARCHS_STANDARD构建设置将不再包含x86_64)2 我在一个多平台项目(Yawara,SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx xros xrsimulator)上用xcodebuild -showBuildSettings -sdk macosx复现了这一点;不带-sdk参数时,该项目根本不会解析出ARCHS_STANDARD,这个细节在Intel那篇文章中有说明。MACOSX_DEPLOYMENT_TARGET = 26.0时,该设置解析为ARCHS_STANDARD = arm64 x86_64;27.0时解析为ARCHS_STANDARD = arm64,而ARCHS_STANDARD_64_BIT在两种情况下都保持arm64 x86_64。4 没有任何警告。如果你发布Universal版本并且要上调目标,请自己把x86_64加进ARCHS。
C++标准库。 “The minimum supported deployment target on macOS for the C++ standard library has been increased to 11.0,”(C++标准库在macOS上支持的最低部署目标已提高到11.0)说明在“Potentially breaking changes”之下列出了行为变化,第一条是multi{map,set}::find不再必然返回第一个匹配元素。2 新特性列表很长:std::chrono值的哈希、zip、std::optional<T&>、std::views::indices(n)等等。2
依赖扫描,以及可能让它失败的规则。 Apple称已对Swift依赖扫描器做了优化,“to avoid redundant setup work and header searches when looking up Clang modules during a single dependency-scan action”(以避免在单次依赖扫描操作中查找Clang模块时的冗余设置工作和头文件搜索),而这一提速附带一项要求:“every Clang module reachable from a single Swift dependency-scan action must have a unique module name. If two module maps visible to the same scan declare a Clang module with the same name, the scan may report an error. Previously, the scanner may have tolerated duplicating names.”(单次Swift依赖扫描操作可达的每个Clang模块都必须有唯一的模块名。如果同一次扫描可见的两个模块映射声明了同名的Clang模块,扫描可能会报告错误。此前的扫描器可能容忍了重名)2 Apple点名了两种会触发它的形态:“projects or SDKs that vend the same Clang module name from more than one location on the header search path, and vendored third-party sources that ship a module.modulemap redeclaring an SDK module.”(在头文件搜索路径的多个位置提供同一Clang模块名的项目或SDK,以及内嵌的、自带一个重新声明SDK模块的module.modulemap的第三方源代码)2 和链接器移除一样,这条规则在工具链升级时触发,而不取决于部署目标;我的ld64文章把两个相互冲突的模块映射送进扫描器,编译了一个会遮蔽SDK模块的内嵌SQLite3垫片,并针对这两种形态审查了七个项目。
什么会无法编译?
@State宏。 这项变化写在iOS 27的发布说明里,而不是Xcode的说明里,而且它取决于你用来构建的编译器,而不是你要部署的目标:”Xcode 27 introduces a new @State implementation that avoids this repeated evaluation. This new behavior back-deploys to iOS 17 aligned OSes. The new @State is implemented with a Swift macro. It is largely source compatible with the property wrapper version, with a few exceptions.”(Xcode 27引入了新的@State实现,避免了这种重复求值。新行为可向后部署到iOS 17同代的系统。新的@State用Swift宏实现,除少数例外,与属性包装器版本基本源代码兼容)6 Apple列出四个例外,其中两个给了代码清单,另外两个各只有一两句话:”In rare situations, the automatic inference of generic arguments of @State is less flexible with the macro implementation. Write the type with more specificity.”(在极少数情况下,@State泛型参数的自动推断在宏实现中不如以前灵活。请把类型写得更具体)以及”Composing @State with other property wrappers or macros is not supported.”(不支持将@State与其他属性包装器或宏组合使用)6 会抓住现有代码的是带代码清单的那两个。其一是给一个已有声明处初始值的@State属性赋值的初始化器:SwiftUI一向会丢弃这个赋值,而现在“some such cases no longer compile.”(其中一些情况不再能编译)6 其二是当所有存储成员都是private时编译器合成的私有逐成员初始化器:“The state macro disables this synthesized initializer. So the code above no longer compiles.”(state宏禁用了这个合成的初始化器,所以上面的代码不再能编译)6 在27A266a上,第一个示例照原样就会失败,在给page赋值的那一行报error: variable 'self.title' used before being initialized,因为宏的setter在title存在之前就对self执行了;把self.title = title移到它上面,同一个文件就能编译,@State赋值照旧被丢弃。46 第二个示例,即在一个@State没有声明处初始值的结构体上,由扩展调用self.init(page: page, title: title),在我的运行中原样通过了编译,宏展开也显示了让它得以通过的形态:宏在一个@storageRestrictions(initializes: _page)的init访问器背后生成了private var _page: SwiftUICore.State<StickerPage>,正是这个构造让逐成员初始化器可以接受page:。4 请把这份说明当作需要检查的形态清单来读,然后在自己的代码上逐一确认。@State宏文章统计了四个已上架App中这两种模式的出现次数;那篇文章是7月根据beta版说明写的,早于这次GA测试,它留下的悬而未决的问题也在这里画上句号:在初始化器内直接给后备存储赋值,即_page = State(initialValue:),无论有没有声明处初始值,在27A266a上都能编译。4
SE-0508造成的破坏。 Swift Compiler的Known Issues写道:”A computed property with both an init accessor and an array/dictionary literal initial value will no longer compile if the getter is declared before the init accessor.”(同时带有init访问器和数组或字典字面量初始值的计算属性,如果getter声明在init访问器之前,将不再能编译)随后是一段代码清单,然后是归因:”This is a known source break from SE-0508.”(这是SE-0508造成的已知源代码兼容性破坏)变通方法全文如下:”Swap the init accessor and the getter such that the init accessor is declared first.”(交换init访问器和getter的位置,使init访问器先声明)2 SE-0508是”Array expression trailing closures”(数组表达式尾随闭包),在Swift 6.4中实现,提案恰好预见了这种情况:”If the getter is declared before the init accessor, we will now attempt to parse as a trailing closure,”(如果getter声明在init访问器之前,我们现在会尝试将其解析为尾随闭包)并补充说”init accessors are however considered for disambiguation, so swapping the accessors is sufficient to make this valid regardless of initial value used,”(不过init访问器会被纳入消歧考虑,因此无论使用何种初始值,交换访问器的顺序就足以使其合法),还说这种情况“does not appear in the source compatibility suite, or for internal Swift projects at Apple.”(未出现在源代码兼容性测试套件中,也未出现在Apple内部的Swift项目中)7 用一个九行的结构体就能复现。getter在前时,swiftc在访问器那一行以error: initializers may only be declared within a type失败;把@storageRestrictions(initializes:)的init访问器移到get上面,同一个文件就能编译。4
struct Container {
private var storage: [Int] = []
var items: [Int] = [] {
@storageRestrictions(initializes: storage)
init(initialValue) { storage = initialValue } // 必须位于get之前
get { storage }
set { storage = newValue }
}
}
PreviewProvider。 Previews一节列出了一项弃用:”PreviewProvider and its family of preview modifiers.”(PreviewProvider及其一族预览修饰符)2 SDK也带上了这项弃用,协议有一条消息,每个修饰符各有一条不同的消息。在iOS 27 SDK的SwiftUI接口中,public protocol PreviewProvider位于@available(anyAppleOS, deprecated: 27.0, message: "Use #Preview instead.")之下;previewLayout的消息是“Use #Preview(traits: .sizeThatFitsLayout) or .fixedLayout(width:height:) instead.”;previewDisplayName是“Use #Preview(‘name’) instead.”;previewInterfaceOrientation是“Use #Preview(traits: .landscapeLeft) or other orientation traits instead.”;previewDevice是“Use the device picker in Xcode’s canvas.”(请使用Xcode画布中的设备选择器);previewContext连同PreviewContext和PreviewContextKey协议则是“Use #Preview with a Widget timeline provider or entries instead.”(请改用带有Widget时间线提供者或条目的#Preview)4 你到底会不会看到这些消息,由两个事实决定。编译器会把弃用版本与部署目标比较,所以修饰符只在最低版本为27.0的目标中警告:一个使用了previewLayout、previewDisplayName和previewDevice的文件,在-target arm64-apple-ios27.0-simulator下产生三条警告,在17.0或26.0下一条也没有。而PreviewProvider本身永远不会警告,原因另有所在。SDK在anyAppleOS弃用标记的正上方用@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)声明了它,在我的探测中,带有这一对属性的协议在27.0目标下,无论是遵循它还是把它用作参数类型都不会警告;而同一个协议若只用@available(iOS, deprecated: 27.0)弃用,或只用anyAppleOS形式弃用,两种用法都会警告。修饰符自身的声明只带anyAppleOS弃用标记(容纳它们的extension SwiftUICore.View带有introduced属性,而这种继承而来的形式并不会抑制警告),这就是修饰符会警告而协议不会的原因。4 在任何实际发布的部署目标下,构建日志两种情况都是静默的,所以请搜索PreviewProvider和这些修饰符并迁移到#Preview,画布现在通过新的#Preview(arguments:)语法按参数以网格形式渲染。24
System的新stat()。 System库现在为stat、lstat、fstat和fstatat提供Swift API,带有Stat类型和FilePath.stat()实例方法。2 说明将一个冲突列为已修复:一个调用未限定stat()的扩展与新方法发生了冲突;如果你在那个冲突还存在时加上了Darwin.限定,可以保留。2
Address Sanitizer,方向相反。 “Address Sanitizer might fail to launch on iOS 27.0, tvOS 27.0, watchOS 27.0, and visionOS 27.0 when building with Xcode 26.4 or older.”(使用Xcode 26.4或更早版本构建时,Address Sanitizer可能无法在iOS 27.0、tvOS 27.0、watchOS 27.0和visionOS 27.0上启动)变通方法是使用Xcode 26.5或更高版本,这对那些CI机器上仍保留旧版Xcode、而设备已更新到27.0的团队很重要。2
IDE和工具变了什么?
- Interface Builder无需模拟器即可构建。 新的编译模式
toolchain,”for UIKit (Cocoa Touch) based documents. Enabled by default,toolchainallows compiling IB documents without the need to download a simulator, which is especially useful for build servers.”(面向基于UIKit(Cocoa Touch)的文档。默认启用的toolchain允许在无需下载模拟器的情况下编译IB文档,这对构建服务器尤其有用)2 - 模拟器启动更快,还能重启。 “The simulator runtimes now contain a pre-built dyld cache. This will make first launch of a simulator much faster,”(模拟器运行时现在包含预构建的dyld缓存,这会让模拟器的首次启动快得多)
simctl新增了reboot命令。2 一个已知问题仍然存在,用Apple的原话说:“Some simulator runtimes are not completely deleted when removed, re-appearing after a reboot.”(某些模拟器运行时在移除后没有被完全删除,重启后会再次出现)2 - devicectl的JSON升到第5版。
xcrun devicectl --version报告642.16,list devices --json-output写出"jsonVersion": 5;Apple弃用了hardwareProperties、deviceProperties和connectionProperties字段,改用一个properties字典,仍包含这些字段的结果会附带_deprecationNotice。24 - StoreKit测试。 StoreKit配置界面可以定义优惠代码,可以为本地测试配置订阅包,Transaction Manager可以在不连设备的情况下演练带优惠代码的购买。2
- Organizer。 Insights Overview“summarizes high-impact performance regressions”(汇总影响重大的性能回退),Hitches指标取代了Scrolling指标。2
- 编码助手。 Google Gemini加入了模型列表,“Planning with agents is now first class in Xcode,”(与代理一起做规划如今是Xcode的一等功能)计划是可编辑的Markdown产物,你先批准,代理再继续;我的编码代理文章介绍了beta版时的工作流,GA版说明中列出了专门用于这些产物的Markdown编辑器。2
- 本地化。 代理可以翻译String Catalog条目,导出本地化内容时现在会从头文件中提取
NSLocalizedString及类似的宏。2 - Icon Composer。 说明称之为Icon Composer 2.0,“a new sharper rendering mode for upcoming 2027 operating systems”(面向即将到来的2027年操作系统的更清晰的新渲染模式);27A266a内置的包报告版本号为27.0。24
- 测试。 测试计划可以设置UI测试期间目标App崩溃时Xcode的处理方式,从关闭到致命失败;
swift test新增了--maximum-repetitions和--repeat-until [pass|fail],并在结尾给出失败摘要。2 - 调试。 在使用桥接头文件时,LLDB“can now directly import explicitly built Swift modules and PCH from DerivedData,”(现在可以直接从DerivedData导入显式构建的Swift模块和PCH)
language swift task tree命令可列出Swift并发任务。2
这周我会做什么
- 动CI之前先读兼容性表的那几行:构建用Mac装macOS 26.6、仅限Apple silicon、最老的测试设备为iOS 17,以及macOS 12、watchOS 9或DriverKit 21中适用于你产品的那一项。23
- 用grep找出
-ld_classic和-ld64并把两者都删掉;前者链接器每次链接都会带警告地忽略,后者会直接失败。既然已经在构建设置里,顺便找找手写的、重新声明了SDK模块的module.modulemap文件,也就是Apple在唯一模块名规则中点名的那种形态。24 - 如果你把任何macOS或DriverKit目标设为27.0并且要发布Intel版本,请显式设置
ARCHS;只靠ARCHS_STANDARD得到的是arm64,这一点我在macOS上复现了,Apple则对两者都有明确说明。24 - 搜索
PreviewProvider、previewLayout、previewDisplayName和previewDevice,按各自注解的消息迁移:协议迁移到#Preview,previewLayout迁移到#Preview(traits: .sizeThatFitsLayout)或.fixedLayout(width:height:),previewDisplayName迁移到#Preview("name"),previewDevice迁移到画布中的设备选择器。修饰符只在27.0部署目标下警告,而PreviewProvider遵循在任何目标下都不警告,所以实际发布目标的构建日志会一直保持安静。4 - 用Xcode 27构建一次,留意两条诊断:一条是
variable 'self.title' used before being initialized,出现在一个在其他存储属性之前给已有声明处初始值的@State属性赋值的初始化器上,@State宏文章对此有逐步讲解;另一条是initializers may only be declared within a type,出现在带有数组或字典字面量初始值和init访问器的属性上,把访问器移到getter上面即可。246 - 趁App Store Connect已开始接受27系SDK,上传一个TestFlight版本,并记住启动画面规则和UIKit场景生命周期强制要求,因为App一旦链接到27,这两条就都会生效。56
常见问题
Xcode 27是什么时候发布的?
2026年9月14日星期一,构建版本27A266a,与iOS 27.0、iPadOS 27.0、macOS 27.0、tvOS 27.0、visionOS 27.0和watchOS 27.0同一天;信息源将其iOS 27.0 RC(24A437)条目标注为9月11日,即App Store Connect开始接受RC SDK构建版本两天之后。15
Xcode 27需要什么版本的macOS?
Apple silicon Mac上的macOS Tahoe 26.6或更高版本。它无法在Intel Mac上安装或运行。它可以在同日发布的macOS 27.0上运行。23
Xcode 27的最低部署目标是多少?
iOS 15、iPadOS 15、tvOS 15、watchOS 9、visionOS 1、macOS 12和DriverKit 21。与Xcode 26.6相比,watchOS从8上调,macOS从11上调,DriverKit从20上调。3
Xcode 27还能构建Universal版Mac App吗?
能,可以向后支持到macOS 12,但一旦目标的MACOSX_DEPLOYMENT_TARGET为27.0,默认就不会了:此时ARCHS_STANDARD只解析为arm64,你需要自己把x86_64加进ARCHS。24
Xcode 27.1发布了吗?
截至2026年9月15日尚未发布。Apple的Releases信息源和Xcode发布说明索引都只列出了Xcode 27,Apple的iPhone Duo开发者页面仍把Xcode 27.1 beta标注为“Coming later this month”(本月晚些时候推出);iPhone Duo SDK不在本次发布之列。1
Xcode 27的发布说明在哪里?
在Apple开发者文档网站的Xcode Release Notes之下,本次发布对应一个页面;本文引用的章节有Overview、Linking、Intel Deprecation、Previews、Swift Compiler、Address Sanitizer、Instruments、Device Hub、devicectl、Simulator、Interface Builder、C++ Standard Library、Organizer、Coding Intelligence、Source Editor、Icon Composer、StoreKit Testing in Xcode、Localization、Testing、Swift Package Manager、Debugging和System。2 @State宏的变化则在iOS和iPadOS 27发布说明的SwiftUI部分。6
参考来源
-
Apple,Releases,2026年9月15日获取的RSS信息源:“Xcode 27 (27A266a)”、“iOS 27.0 (24A437)”、“iPadOS 27.0 (24A437)”、“macOS 27.0 (26A428)”、“tvOS 27.0 (24J361)”、“visionOS 27.0 (24M362)”、“watchOS 27.0 (24R364)”和“App Store Connect Update”均标注为2026年9月14日星期一;“iOS 27.0 RC (24A437)”标注为2026年9月11日星期五。Xcode Release Notes索引只列出一个27系条目“Xcode 27 Release Notes”;两处均无27.1条目。Apple Developer,Get Ready for iPhone Duo,2026年9月15日获取:“Xcode 27.1 beta. Get the latest SDKs to build, run, and test your app for iPhone Duo. Coming later this month”(Xcode 27.1 beta。获取最新SDK,为iPhone Duo构建、运行和测试你的App。本月晚些时候推出)。 ↩↩↩↩↩
-
Apple,Xcode 27 Release Notes,GA发布后于2026年9月15日获取。引用的章节:Overview;Linking,Deprecations(”The ld64 linker has been removed and the
-ld_classicoption is no longer supported.” 165165518);Intel Deprecation,New Features(ARCHS_STANDARD,161837535)和Deprecations(仅限Apple silicon,全文引用,162138432);Previews,Deprecations(”PreviewProviderand its family of preview modifiers.” 144168701)和New Features(#Preview(arguments:),167544057);Swift Compiler,New Features(依赖扫描器和唯一模块名要求,节选,136303612)和Known Issues(SE-0508,180969028;变通方法一句全文引用);System,New Features和Resolved Issues(177911316);Address Sanitizer,Known Issues(178072780);Instruments,Deprecations(166097304);Device Hub,Deprecations(160482487);devicectl,New Features(170812159)和Deprecations(183772705);Simulator,New Features(179846743、172303413)和Known Issues(141290052);Interface Builder,New Features;C++ Standard Library,New Features和Deprecations;Organizer;Coding Intelligence(171990272、172857081);Source Editor,New Features(Markdown编辑器,175022151);Localization;Icon Composer;StoreKit Testing in Xcode;Testing;Swift Package Manager,New Features(--maximum-repetitions,177561078;失败摘要,168311253);Debugging。 ↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩ -
Apple,Xcode support: minimum requirements and supported SDKs,2026年9月15日获取。Xcode 27一行:macOS Tahoe 26.6或更高版本;SDK为iOS 27、tvOS 27、watchOS 27、visionOS 27、macOS 27、DriverKit 27;部署目标为iOS 15至27、iPadOS 15至27、tvOS 15至27、watchOS 9至27、visionOS 1至27、macOS 12至27、DriverKit 21至27;设备支持iOS 17、tvOS 17、watchOS 10、visionOS 1或更高版本;模拟器iOS 17、tvOS 17、watchOS 10、visionOS 1或更高版本;Swift 6.4编译器,语言模式6、5、4.2和4。Xcode 26.6一行:macOS Tahoe 26.2至26.x;SDK为26.5,DriverKit 25.5;部署目标iOS 15、tvOS 15、watchOS 8、visionOS 1、macOS 11、DriverKit 20;设备和模拟器支持自iOS 15、tvOS 15、watchOS 8、visionOS 1起;Swift 6.3。 ↩↩↩↩↩↩
-
作者复现,Xcode 27.0(27A266a),
DEVELOPER_DIR指向它,macOS 26.6.2(25G83),2026年9月15日。xcodebuild -version:“Xcode 27.0 Build version 27A266a”;swift --version:“Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)”;工具链的usr/bin只列出一个链接器ld,ld -v打印“PROJECT:ld-27037.1”,构建于“Aug 25 2026”;hello.c包含int main(void){return 0;}时,clang hello.o -o hello_classic -Xlinker -ld_classic打印“ld: warning: -ld_classic is no longer supported and will be ignored”并以退出码0结束,clang hello.c -o hello_ld64 -Wl,-ld64打印“ld: library ‘d64’ not found”和“clang: error: linker command failed with exit code 1 (use -v to see invocation)”,以退出码1结束且没有输出文件。对Yawara.xcodeproj运行xcodebuild -showBuildSettings -sdk macosx,这是一个多平台项目(SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx xros xrsimulator),不带-sdk参数时不会打印ARCHS_STANDARD行:MACOSX_DEPLOYMENT_TARGET = 26.0时ARCHS_STANDARD = arm64 x86_64,27.0时ARCHS_STANDARD = arm64,两种情况下都是ARCHS_STANDARD_64_BIT = arm64 x86_64。带有var items: [Int] = []和一个@storageRestrictions(initializes: storage) init(initialValue)访问器的九行Container结构体:getter在前时在init一行以“error: initializers may only be declared within a type”失败;访问器在前时以退出码0编译通过。iPhoneOS 27.0 SDK中的SwiftUI.swiftmodule/arm64e-apple-ios.swiftinterface:@available(anyAppleOS, deprecated: 27.0, message: "Use #Preview instead.")位于第14971行(public protocol PreviewProvider)、第14978行(其扩展)和第14991行(PreviewPlatform);“Use #Preview with a Widget timeline provider or entries instead.”位于第15023行(PreviewContextKey)、第15029行(PreviewContext)和第15069行(previewContext);“Use the device picker in Xcode’s canvas.”位于第15053行(previewDevice);“Use #Preview(traits: .sizeThatFitsLayout) or .fixedLayout(width:height:) instead.”位于第15058行(previewLayout);“Use #Preview(‘name’) instead.”位于第15063行(previewDisplayName);“Use #Preview(traits: .landscapeLeft) or other orientation traits instead.”位于第15075行(previewInterfaceOrientation)。用swiftc -c编译一个裸的PreviewProvider遵循,在-target arm64-apple-ios27.0-simulator、ios26.0和ios17.0下均无警告;一个在PreviewProvider内应用了previewLayout(.sizeThatFits)、previewDisplayName("Card")和previewDevice(PreviewDevice(rawValue: "iPhone 18 Pro"))的文件,在ios27.0下产生三条[#DeprecatedDeclaration]警告(“’previewLayout’ was deprecated in any Apple OS 27.0: Use #Preview(traits: .sizeThatFitsLayout) or .fixedLayout(width:height:) instead.”,以及对应的previewDisplayName和previewDevice消息),在ios26.0和ios17.0下没有。一个探测包含四个协议,每个协议各有一个遵循它的结构体,并在一个函数签名中使用any P参数,在-target arm64-apple-ios27.0-simulator下编译:单独的@available(iOS, deprecated: 27.0)、单独的@available(anyAppleOS, deprecated: 27.0),以及@available(iOS, deprecated: 27.0)上方加@available(iOS 13.0, *),三者都在遵循行和any P参数类型上警告(“’P1’ was deprecated in iOS 27.0”、“’P2’ was deprecated in any Apple OS 27.0”、“’P4’ was deprecated in iOS 27.0”),而SDK使用的那一对,即@available(anyAppleOS, deprecated: 27.0)上方加@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *),两处都没有警告;通过这些存在类型进行的方法调用在四种情况下都没有诊断,在ios26.0下四种情况都不警告。在接口中,PreviewProvider位于第14970至14972行,正是在那一对属性之下;previewLayout位于第15058至15059行,其自身声明只带anyAppleOS弃用标记,位于一个extension SwiftUICore.View内,该扩展的introduced属性在第15051行。一个包含两个视图的文件,都在init(title:)内赋值_page = State(initialValue: StickerPage(title: title)),一个是@State private var page: StickerPage,另一个是@State private var page = StickerPage(),在ios27.0下以退出码0编译通过,没有任何诊断。@State探测各是一个带有@State private var page和let title: String的StickerPageView,针对iPhoneSimulator 27.0 SDK用swiftc -c -target arm64-apple-ios27.0-simulator编译:Apple的第一个示例,@State private var page = StickerPage()加上一个先赋值self.page再赋值self.title的init(title:),在self.page一行以“error: variable ‘self.title’ used before being initialized”失败,退出码1;把self.title = title移到self.page赋值之上的同一文件编译通过,退出码0;Apple的第二个示例,没有初始值的@State private var page: StickerPage加上一个调用self.init(page: page, title: title)的扩展,编译通过,退出码0,-Xfrontend -dump-macro-expansions显示宏生成了private var _page: SwiftUICore.State<StickerPage>,并带有一个@storageRestrictions(initializes: _page) init(initialValue)访问器。xcrun devicectl --version:642.16;devicectl list devices --json-output写出"jsonVersion": 5。27A266a内Icon Composer的Info.plist:CFBundleShortVersionString为27.0。 ↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩↩ -
Apple,App Store Connect release notes,2026年9月15日获取。2026年9月14日的条目已在上表中全文引用;2026年9月9日的条目记录了RC SDK上传,并新增了iPhone Duo、iPhone 18 Pro Max、iPhone 18 Pro、Apple Watch Ultra 4和Apple Watch Series 12的截图和App预览规格,附有“Support for uploading assets for iPhone Duo in App Store Connect will be available later this year.”(App Store Connect对iPhone Duo素材上传的支持将于今年晚些时候提供)。 ↩↩↩↩↩
-
Apple,iOS & iPadOS 27 Release Notes,SwiftUI,New Features(105893279),2026年9月15日获取。以下引文的出处:”Xcode 27 introduces a new
@Stateimplementation that avoids this repeated evaluation. This new behavior back-deploys to iOS 17 aligned OSes. The new@Stateis implemented with a Swift macro. It is largely source compatible with the property wrapper version, with a few exceptions.”;附有StickerPageView清单的”If you provide an initial value at@Statedeclaration, and also try to assign a value to it in an initializer, the initializer value is discarded. This behavior has not changed because of the macro, but some such cases no longer compile:“;附有清单的”When all stored members of a struct are private, the compiler synthesizes a private init that can be used in an extension of the same type:“;以及”The state macro disables this synthesized initializer. So the code above no longer compiles. To mitigate, assign value to members explicitly:“;还有两个没有清单的例外,”In rare situations, the automatic inference of generic arguments of@Stateis less flexible with the macro implementation. Write the type with more specificity.“和”Composing@Statewith other property wrappers or macros is not supported.”。同一文档的UIKit部分载有第6步引用的两项要求:New Features中的”iOS and iPadOS apps built with the 27.0 SDK or later are required to include a launch screen.”(使用27.0或更高版本SDK构建的iOS和iPadOS App必须包含启动画面)(168247372),以及Deprecations中的”Apps built with the latest SDK must adopt the scene-based life cycle or they fail to launch.”(使用最新SDK构建的App必须采用基于场景的生命周期,否则无法启动)(141837548)。 ↩↩↩↩↩↩↩↩↩↩ -
Cal Stephens,SE-0508: Array expression trailing closures,Swift Evolution,状态”Implemented (Swift 6.4)”,实现为swiftlang/swift#86244,2026年9月15日获取。”Init accessors”小节是以下引文的出处:”One other case where this can result in an error is for properties with both an
initaccessor and initial value that is either an array or dictionary literal. If the getter is declared before theinitaccessor, we will now attempt to parse as a trailing closure:”、上文引用的消歧一句,以及”This particular case appears to be quite rare in practice, it does not appear in the source compatibility suite, or for internal Swift projects at Apple.”。 ↩ -
Apple,Xcode 15 Release Notes,Linking,New Features(108915312),2026年9月15日获取:“The classic linker can still be explicitly requested using -ld64, and will be removed in a future release.”(经典链接器仍可通过-ld64显式请求,并将在未来版本中移除)。 ↩↩