iOS 26环境下使用FoundationModels API调用本地LLM失败的问题求助
各位好,我最近在iOS 26上尝试用新的FoundationModels API时卡壳了——明明是照着WWDC视频教程写的极简代码,结果不管是模拟器还是真机都报错,想请教下大家有没有头绪?
先贴一下我的核心调用代码,就是最基础的prompt请求逻辑:
func sendPrompt() async { do { errorText = "" let prompt = """ Generate a list of suggested search terms for an app about visiting famous landmarks. """ let session = LanguageModelSession( model: SystemLanguageModel(useCase: .general) ) let response = try await session.respond(to: prompt) print(response.content) responses.append(response.content) } catch { print(false, "Failed to interact with the local LLM: \(error)") errorText = error.localizedDescription } }
在模拟器上运行时,报的错误是:
InferenceError::inferenceFailed::Error Domain=com.apple.UnifiedAssetFramework Code=5000 "There are no underlying assets (neither atomic instance nor asset roots) for consistency token for asset set com.apple.modelcatalog" UserInfo={NSLocalizedFailureReason=There are no underlying assets (neither atomic instance nor asset roots) for consistency token for asset set com.apple.modelcatalog}
而在真实的iOS 26设备(我用的是旧款iPhone 11)上,报错信息简洁了些:
FoundationModels.LanguageModelSession.GenerationError error 1
我的开发环境是macOS Sequoia + Xcode 26 beta。我本来以为模拟器会复用Mac上已有的模型(毕竟模型文件体积很大,没必要重复下载),真机的话iOS 26应该内置了Foundation Model才对?而且我在Xcode里编译时没遇到任何编译错误,FoundationModels框架也能正常引入。
现在我有几个核心疑问想请教大家:
- iOS 26的第一个开发者beta版本里,到底有没有预装本地的Foundation Model?会不会是这个版本根本没把模型内置进去?
- 真机上的
GenerationError error 1有没有对应的具体原因或者解决方向? - 我关于模拟器复用Mac模型的猜想是不是错的?有没有办法让模拟器正常加载模型?
- 会不会是我用的iPhone 11太旧,不支持内置的Foundation Model?
内容来源于stack exchange

