r/iOSProgramming • • 25d ago

Question Apple foundation models

If you're using Apple's Foundation Models framework in a released app, how are you debugging issues that only happen on users' devices?

Are Instruments and your existing crash reporting enough, or have you added custom logging?

11 Upvotes

17 comments sorted by

View all comments

1

u/jrkral2 18d ago

Adding an angle the thread hasn't covered: apps where nothing can leave the device at all. I'm the developer of Faraday, a therapy-notes app built on Foundation Models, and the privacy model is that session content never leaves the phone, so even the counts-only remote layer suggested above is something I'd rather not depend on.

What I'd suggest in that situation:

  • Keep a small local diagnostics log (OSLog with privacy: .private on anything content-derived, plus a ring buffer in the app container) with availability state, the error case, input token estimate vs. the context limit, chunk index, OS build and locale. No prompt or output text.
  • Give the user an "export diagnostics" button that shows them exactly what's in it before they share it, by email or however they choose. They decide, and you get the same fields you would have logged remotely.
  • exceededContextWindowSize and guardrailViolation are the two cases I'd expect most in the field, and both tend to reproduce locally once you know the input length and locale, so logging lengths gets you a long way.
  • Test a TestFlight build on a real device with Apple Intelligence turned off and with the model assets not yet downloaded. availability returns different unavailable reasons, and those paths are easy to miss in the simulator.

1

u/trikboomie 16d ago

Really useful angle, thanks. For Faraday, how often do users actually hit "export diagnostics", and has a shared export ever let you fix something you couldn't reproduce otherwise? If a local-only diagnostics library existed that never phoned home, would you use it, or would you still rather own that code?

1

u/jrkral2 13d ago

Honest answer: too early to tell. Faraday is new, and since it has no analytics I only find out about an export when someone chooses to send one, which hasn't happened often enough to say anything useful yet. So I can't claim a shared export has caught something I couldn't reproduce.

On the library: I'd look at it, but I'd probably still want to own that code. For an app like this the thing that matters is the guarantee that nothing leaves the device unless the user sends it, and that's easier to reason about, and to square with the privacy label, when I control every line. If it were small, had no dependencies and no networking code at all, so you could confirm that with a quick search of the source, that would make it a lot easier to say yes.