You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS 26环境下使用FoundationModels API调用本地LLM失败的问题求助

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 09:53:06