安装 Xcode 15.3 后突然发生这种情况。 iOS 17.4 以外的版本(例如 17.2,我的最低部署目标)上的模拟器和实际设备在启动时都会崩溃。它在 iOS 17.4 上运行良好。错误信息是这样的:
dyld[2687]: Symbol not found: _$s10AppIntents0A16ShortcutsBuilderO10buildBlockySayAA0A8ShortcutVGAGd_tFZ Referenced from: <CAAA4ECB-9E8B-3089-BAA3-30353A952A4F> /Users/abc/Library/Developer/CoreSimulator/Devices/855CEC69-3F94-4A57-99DA-23000B104AC5/data/Containers/Bundle/Application/F72ABCFE-4B85-461E-9B1D-4589DAB9262F/MyApp.app/MyApp Expected in: <6683DFEB-450B-3643-B865-E4D9D0B501D6> /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AppIntents.framework/AppIntents
如果我注释掉与快捷方式相关的代码(只有几行),问题就消失了:
import Intents
import SwiftData
import AppIntents
struct MyAppIntent: AppIntent {
static var title: LocalizedStringResource = "doSomething"
@Parameter(title: "myParam")
var myParam: URL
@MainActor
func perform() async throws -> some IntentResult {
// perform task here ...
return .result()
}
static var parameterSummary: some ParameterSummary {
Summary("Summary")
}
}
struct MyAppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: MyAppIntent(),
phrases: ["MyAppIntent"],
shortTitle: "MyAppIntent",
systemImageName: "play.rectangle.fill"
)
}
}
没有安装额外的框架,我已经清理了构建文件夹并多次重新启动了所有内容。 TestFlight 版本上也发生了这种情况。
我可以尝试解决这个问题吗?
我也有同样的问题!它甚至发生在运行 17.3.1 的用户设备上(每天 20 多次崩溃)。
Apple刚刚发布了15.4,似乎修复了模拟器17.2中的问题;希望这也能解决用户设备上的问题!