What this thread does
Expose reporting, blocking and account deletion; commit a durable deletion job before clearing local credentials.
What changed for implementation
- UGC needs filtering, reporting with timely responses, blocking and published contact details under Apple Guideline 1.2.
- Since June 30, 2022, account-creating apps must offer in-app deletion initiation; temporary deactivation is insufficient, and shared UGC is included. A delayed process must explain its timing and confirm completion. Apple account-deletion guidance
Do first: define acceptance and completion separately
Use Settings → Account → Delete Account with a confirmation explaining removal and timing. Include guest accounts created automatically. Reauthentication is allowed; ordinary apps must not force a support email or call. Explain continuing Apple subscription billing and link subscription management. For Sign in with Apple, include token revocation. Apple guidance
This proposed implementation maps Apple’s requirements onto database primitives; Apple does not prescribe its tables or protocol.
1. Make moderation enforceable. Add server-side filtering before publication, a report record and moderation queue, a unique (blocker_id, blocked_id) relation, and a visible contact route. Enforce blocks across feeds, detail access and interactions/notifications. Assign an owner and response-time target for reports. These are implementation choices for the four required UGC controls; a block table alone does not provide moderation.
2. Persist recovery before sending. Generate a random request ID and a separate high-entropy receipt secret, and persist them in an account-scoped Keychain record before the authenticated deletion request. Store only the secret’s hash on the server. Bind both to the immutable account ID; reject reuse against another account or operation. The receipt endpoint may reveal only deletion status, never profile data or mutation authority. This proposed capability resolves a lost response after login credentials stop being usable. Keychain persistence and scoped removal use Apple’s Keychain APIs.
3. Accept atomically. In one transaction, lock the account row, insert-or-read one deletion_jobs row per account, bind the receipt, set deletion_pending, revoke ordinary sessions and commit. Make all account writes, including queued writes, honor that state and lock. Return the existing job for a duplicate request. A unique constraint with PostgreSQL ON CONFLICT provides the insertion primitive; explicitly select the existing row after DO NOTHING, which returns no inserted row on conflict. Competing writes must share the lock; see row locking.
4. Acknowledge pending truthfully. Return 202 Accepted with the job status location only after commit. A receipt-authenticated status lookup must remain available after session revocation. If the initial response disappears, use the already persisted receipt to distinguish accepted/pending/completed from no matching job; absence must not be displayed as completion. A new deletion request still needs account authentication. 202 means accepted, with processing incomplete, under HTTP Semantics §15.3.3.
5. Run repeatable deletion steps. Keep job identity independent of a cascading account foreign key. Record progress for provider-token revocation, authored UGC/media, personal records, search/cache copies and downstream processors. Preserve the minimum revocation material until that step succeeds. External effects need their own repeat-safe operation or reconciliation. For multiple workers, claim jobs using FOR UPDATE SKIP LOCKED, write a bounded lease and commit before external calls; reclaim expired leases, fence stale workers’ updates with the lease generation, and retry failures with backoff and operator escalation. PostgreSQL documents this locking option for queue-like tables. This is at-least-once processing, with repeat-safe steps required; job uniqueness does not establish exactly-once effects.
6. Clean local state after durable acceptance. Cancel old-account requests, invalidate their response generation, empty in-memory auth and account caches, and delete only that account’s auth items. Use the original storage attributes; repeat for each credential service/access group:
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: "com.example.app.auth",
kSecAttrAccount as String: oldAccountID
]
let status = SecItemDelete(query as CFDictionary)
guard status == errSecSuccess || status == errSecItemNotFound else {
throw CleanupError.keychain(status)
}
Apple’s deletion example accepts both statuses and explains that all matching items are removed. Block stale credential reuse on other statuses. Remove account keys with removeObject(forKey:) from each defaults suite actually used, including an App Group where applicable; removing a key affects only the target defaults domain). Scope cleanup to the captured old account so a late callback cannot clear a newly signed-in account. Expire the separate status receipt after completion or its documented lifetime.
7. Complete only after required steps finish. Notify through the status UI or agreed channel; expire job/receipt records under a documented policy. Do not mark an account deleted merely because public visibility stopped. Explain any legally required retained data; include backup expiry and restoration handling in the data inventory. Apple requires deletion of associated data except required retention and completion confirmation for delayed deletion.
Evidence
- javikr, Trakt discussion, 2023-02-13 and 2023-02-27: reported rejection because a website link did not go directly to the deletion completion page, then reported approval after explaining the third-party flow. This supports an explicit destination, not approval for this job design.
- Cylon999: a forum-client developer reported an update rejection requesting account deletion. Prior distribution is not evidence that a later update can omit the feature.
Limits
Before shipping, exercise duplicate requests, response loss after commit, worker death after an external deletion, expired leases, Keychain failure, offline relaunch and switching accounts during cleanup. Check deletion across content, media and processor inventories. These reports do not establish complete erasure or App Review approval.
Not for: SwiftUI NavigationSplitView layout bugs, App Tracking Transparency permission prompts, or deciding statutory retention periods.
Started from a post by @editor, packaged by the editor. Original post