Issue with #Playground and Foundation Model

Hi all,

I’m encountering an issue when trying to run Apple Foundation Models in a blank project targeting iOS 26.

Below are the details:

  • Xcode: Latest version with iOS 26 SDK
  • macOS: macOS 26 Tahoe (installed on main disk)
  • Mac: 16” MacBook Pro with M2 Pro chip
  • Apple Intelligence: Available and functional on this machine

Problem:

I created a new blank iOS project, set the deployment target to iOS 26, and ran the following minimal code using Foundation Models. However, I get no response at all in the output - not even an error. The app runs, but the model does not produce any output.

#Playground {
    let session = LanguageModelSession()
    let response = try await session.respond(to: "Tell me a story")
}

Then, I tried to catch an error with this code:

#Playground {
    let session = LanguageModelSession()
    
    do {
        let response = try await session.respond(to: "Tell me a story")
        print(response)
    } catch {
        print("Failed to get response:", error)
    }
    
    print("This line, never gets executed")
}

And got these results:

I’ve done further testing and discovered something important:

I tried running the Code Along sample project, and there the #Playground macro worked without issues. The only significant difference I noticed was the Canvas run destination:

  • In my original project, I was using iPhone 16 Pro (iOS 26) as the run target in Canvas. Apple Intelligence was enabled on the simulator, but no response was returned when executing the prompt.
  • In the sample project, the Canvas was running on My Mac.

I attempted to match that setup, but at first, my destination was My Mac (Designed for iPad), which still didn’t work. The macro finally executed properly once I switched to My Mac (AppKit).

So the question is ... it seems that for now, Foundation Models and the #Playground macro only run correctly when the canvas or destination is set to “My Mac (AppKit)”?

Answered by DTS Engineer in 847829022

I'd like to be clear that the Foundation Models framework and #Playground do support iOS simulators, and I've confirmed that the code snippet provided above works with my following configuration, as shown in the attached screenshot:

  • MacBook Pro with Apple M4 chip.
  • macOS 26.0 Beta (25A5295e), Apple Intelligence is enabled and works.
  • Xcode 26.0 beta 2 (17A5241o)
  • The iOS simulator: iPhone 16 Pro (23A5276e)

I can't explain why the error happens on your side though. One common-seen unsupported configuration is macOS 15.x + iOS simulator, which is not your case as you confirmed that you ran macOS 26 Tahoe.

You can double check if your configuration has any difference from mine – I am on Beta 2, and your Mac with the M2 chip should work. If the the problem is still there, I’d suggest that you file a feedback report with a sysdiagnose, and share your report ID here. See this post for how to provide actionable feedback for the Foundation Models framework.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

I've encountered the same issue, the macro only worked when targeting My Mac (AppKit)

Also running the same exact code that runs fine on the mac simulator on iPhone simulators with iOS 26

result in this error:

guardrailViolation(FoundationModels.LanguageModelSession.GenerationError.Context(debugDescription: "Safety guardrail was triggered after consecutive failures during streaming.", underlyingErrors: []))

From my understanding, Apple Intelligence is not available on iOS simulators in Xcode: that is why you must run the code on your own Mac for it to work. Have you tried running this code without the #Playground macro? I don't think that that would make a difference but it would be good to rule it out.

However, the code should work the same on iOS and macOS. If you must test your code on an iOS device, you could try it on your iPhone with the iOS 26 beta installed (assuming that your phone supports Apple Intelligence).

I'd like to be clear that the Foundation Models framework and #Playground do support iOS simulators, and I've confirmed that the code snippet provided above works with my following configuration, as shown in the attached screenshot:

  • MacBook Pro with Apple M4 chip.
  • macOS 26.0 Beta (25A5295e), Apple Intelligence is enabled and works.
  • Xcode 26.0 beta 2 (17A5241o)
  • The iOS simulator: iPhone 16 Pro (23A5276e)

I can't explain why the error happens on your side though. One common-seen unsupported configuration is macOS 15.x + iOS simulator, which is not your case as you confirmed that you ran macOS 26 Tahoe.

You can double check if your configuration has any difference from mine – I am on Beta 2, and your Mac with the M2 chip should work. If the the problem is still there, I’d suggest that you file a feedback report with a sysdiagnose, and share your report ID here. See this post for how to provide actionable feedback for the Foundation Models framework.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Issue with #Playground and Foundation Model
 
 
Q