r/iOSProgramming • • 27d 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

Show parent comment

1

u/trikboomie 26d ago

This really is helpful.

Once the app is published, how do you actually collect and investigate this across users’ devices?

Do you send selected events to an existing service, rely on user-submitted bug reports, or use something else?

1

u/Significant_Door_433 25d ago

Two layers is a common setup.

Counts, no content: when availability isn't .available or a session throws, send the reason or the error case name as a non-fatal event to whatever you already have (Crashlytics record(error:), Sentry captureError, or a tiny endpoint of your own). Tag it with OS build, device model and locale. That shows you which case is common and whether it clusters on one OS build. Leave prompts and responses out of it, otherwise your privacy label changes and you need consent.

Detail on request: for a single user's bug, add a "Send report" button that reads your own entries back with OSLogStore(scope: .currentProcessIdentifier), filters on your subsystem, and attaches that plus the session transcript to a mail or form the user sends themselves. Catch is that on iOS this only sees the current launch, so the button has to be reachable before they kill the app. For anything older, ask them for a sysdiagnose, but your .private fields are redacted there.

MetricKit won't help much here since these are thrown errors, not crashes or hangs.

1

u/trikboomie 25d ago

Have you actually run that two-layer setup in a shipped app?

1

u/Significant_Door_433 24d ago

Not in a shipped app, no. I'm going off Apple's docs for OSLogStore and the privacy label rules, so I wouldn't trust it until you've run the report button on a real device build via TestFlight. Simulator and device can differ in what the store returns. The part I'd keep either way is logging the error reason and OS build, never the prompt text.