The setup check
The setup check is the one view the SDK has: a panel for you, the developer, never for your users. It answers twenty questions about your setup from what the SDK found, each row green, amber, red or grey, with the detail and how to fix it, and has buttons that try each part.
Turn it on
Section titled “Turn it on”CrmConfig(apiBase: apiBase, appKey: appKey, appVersion: appVersion, debug: true)With debug on:
- After
start(), once PurrCRM has answered for your app’s public face (or not), the panel comes up over the app as a sheet, in a window of its own above your alerts, once a scene is in front. - Every request is written to the log: method, path (with every id taken out), status, time and request id, never a token. For example
CrmSdk: GET /guest/v1/conversations/:id 200 84ms request_id=…. - An event name you did not declare is logged as it is dropped.
Keep debug for your own builds: turn it off in what your users install. A release build with it on (releaseBuild: true) logs a warning once a launch (Test mode).
You can also show it any time, with debug off, from a hidden menu of your own: crm.showSetupCheck(). And await crm.runSetupChecks() answers the rows ([CrmSetupCheck]) without the panel, for a screen of your own or a test.
The panel
Section titled “The panel”CRM setup check lists the rows under their sections. Tap a row to see its detail and How to fix. Collapse shrinks the panel to a pill, “CRM ● 17/20” (the green rows of all of them), which you can drag out of the way and tap to open again; it turns amber or red with the worst row. Hide for this launch puts it away until the app starts again. Touches beside the panel reach your app.
The text is English, it follows Dynamic Type and dark mode, and every control has a VoiceOver label.
The checks
Section titled “The checks”Grey means skipped: not asked yet, or something the SDK cannot tell. Each How to fix names the place on PurrCRM‘s site and the page of these docs that explains it (such as “Docs: iOS › Push”). Run checks again after you change something.
| Row | Says | When it is not green |
|---|---|---|
| Version and kind | ios 0.2.0, as sent with every request. | Always green. |
| Started and ready | Whether start() was called, and how long after it setReady(true) came. | Red: start() was never called; call it once at launch (Initialise). Amber: ready more than 10 seconds after start, or not ready after 10 seconds; call setReady(true) as soon as the user is past sign-in (Sign users in). |
| Lifecycle followed | Whether the app’s going to the background and coming back was seen. | Grey until you send the app to the background and back. Amber with followLifecycle off until your app calls appPaused() and appResumed(). |
| Row | Says | When it is not green |
|---|---|---|
| Server reachable | Whether apiBase answered, and in how long. | Red, with why: TLS failed, the host name did not resolve, plain http blocked by App Transport Security, no answer in time, or could not connect. Check apiBase and the phone’s connection; a PurrCRM on your own computer over http needs an App Transport Security exception for it, in that build only. |
| App key and mode | The app’s name and mode (live or test). | Red: PurrCRM does not know the key; copy it from the App key card on Settings › your app › Developers › Install. Amber: a test key in a release build. |
| Features | Which of the messenger, help center and in-app messages are on. | Amber: some are off. Switch them on in Settings › your app › General (Name and features), if the app uses them. |
Sign-in
Section titled “Sign-in”| Row | Says | When it is not green |
|---|---|---|
| Sign-in mode | Tokens, or unverified. | Amber: unverified sign-in, for prototypes only (Sign users in). |
| Token | Your token, read as a JWT: its alg and when it expires. | Red: your CrmTokens threw (the error is shown), the token is not a JWT, it has no sub or no iat, or an HS256 token expires more than 30 days ahead. Amber: issued in the future, or expired, by the phone’s clock (the phone’s clock is wrong). Fix what your backend signs. |
| Guest call | Whether PurrCRM took the user, on a real request. | Red: refused (401), so the token is not the app’s (check the secret it is signed with, and its claims; paste it into Test a token on Settings › your app › Developers › Sign-in), or the request did not get through. |
| Session | The user signed in. | Amber: no session; call crm.session(CrmSession(guestId:)) once the user signs in. |
Events
Section titled “Events”| Row | Says | When it is not green |
|---|---|---|
| Queue | How many events are waiting, and how the last batch went (accepted, rejected with reasons, refused with its request id, or failed). | Amber: sends are failing and backing off; the detail says why. Events are kept and sent later. |
Pushes
Section titled “Pushes”| Row | Says | When it is not green |
|---|---|---|
| Permission | The phone’s notification permission: authorized, provisional, ephemeral (an App Clip’s), denied or not asked. | Amber: denied, so the user turned notifications off in Settings. Grey: not asked yet, or an answer the SDK does not know (“can’t tell”). |
| Token registered | The first characters of the push token, and whether it was registered this run. | Grey: no token yet; hand Firebase’s token to crm.registerPushToken (Push). Red: the token is shaped like Apple’s device token (only hex digits), not Firebase’s. Amber: not registered this run; a user must be signed in (see Guest call). |
| Handler wired | When a push of PurrCRM‘s last reached handlePushArrival or handlePushTap on this install. | Amber: none seen yet. Pass each push’s userInfo to both, then send one with Push my phones on Settings › your app › Delivery › Push. |
| Row | Says | When it is not green |
|---|---|---|
| Link host | Your app’s link base. | Grey until PurrCRM has answered. |
| Universal Links | Whether the link host’s apple-app-site-association names your bundle id for /messages, and, in a development build, whether the app’s Associated Domains entitlement has applinks:<host>. | Red: the file could not be fetched, or does not name your bundle id (add <team id>.<bundle id> under iOS apps on Links › Setup), or the entitlement lacks the host (Links). Grey: the entitlement cannot be read, as in a simulator or an App Store build. |
| Declared links | How many CrmHost.links you declare, and their digest. | Amber: a path that does not start with / or has a space. |
| Deferred links | Whether deferredLinksFromClipboard is on, a claim is kept, or one was made this run. | Grey: off; turn it on, with Keep links through an iPhone’s install on Links › Setup (Links through an install). |
Host and storage
Section titled “Host and storage”| Row | Says | When it is not green |
|---|---|---|
| Navigation hooks | Whether navigate and openInApp are set, and something watches inApp.next. | Amber: names what is missing (Initialise, In-app messages). |
| Store works | A write, read and delete in the SDK’s store. | Red: the CrmStore in CrmConfig.store failed. |
The test buttons
Section titled “The test buttons”Each says what it did under the buttons, then runs the checks again:
| Button | What it does | In code |
|---|---|---|
| Run checks again | Gathers everything afresh. | runSetupChecks() |
| Send a test event | Records screen_viewed for the screen crm_setup_check and sends the queue now. | sendTestEvent() |
| Check in now | Checks in for in-app messages at once; says how many tests came, how many messages wait, whether there is a banner, whether this is a test phone, and whether your app watches inApp.next. | checkInForSetup() |
| Open messenger, Open help center | Opens them through your navigate hook. | open(.messenger) |
| Copy guest id | Copies the signed-in user’s id, to find them on PurrCRM. | |
| Test a push | Registers the push token again for the user signed in; then send a push from PurrCRM. | testPush() |
| Test links | Makes a link to /messages, and a share link with its short form (with a user signed in), and offers each three ways: Open here (through handleLink, saying where it goes), Open through iOS (as a Universal Link only, which says whether iOS opened it in the app), and Share (to tap it from Notes or Messages). | testLinks(), tryLink(_:) |
| Export report | Shares the report. | setupReportText() |
The report
Section titled “The report”Export report shares plain text: the time, the SDK’s kind and version, your apiBase, app key and bundle id, then every row with its status (OK, WARN, FAIL, --), detail and fix. It never holds a token: anything shaped like one is taken out. Attach it when you ask for help.