AceMobileInterview

Interview guides / ios

Crashy notes list: iOS Interview Question

Crashy notes list interview question with a clear example answer for iOS engineers. Practice with AceMobileInterview.

This is a common iOS interview topic: Crashy notes list.

Below is a concise answer you can adapt in a real interview, then go deeper in the full AceMobileInterview track.

  1. 1.Download the buggy zip. Deleting notes or opening detail can crash. Find unsafe indexing/force-unwraps and harden the flow (≈30–45 min).

    ## Scenario Notes list crashes on empty state and after rapid delete + detail tap. ## How to investigate - Turn on Exception Breakpoint - Reproduce: delete last note; delete then immediately tap a row - Search for `!` force unwraps and `notes[indexPath.row]` ## Planted bug 1: Force unwrap on selected note **Symptom:** Crash when opening detail with no selection **Root cause:** `detailNote!` in segue / push helper **Fix:** `guard let note else { return }`; disable detail when empty ## Planted bug 2: Stale index after delete **Symptom:** Out-of-bounds after delete animation **Root cause:** Action handler captures `indexPath.row` then mutates array before use **Fix:** Capture `note.id`; look up by id; or delete via `IndexPath` inside `performBatchUpdates` consistently ## Planted bug 3: Missing empty state **Symptom:** Table assumes ≥1 row elsewhere **Root cause:** `numberOfRows` can be 0 but toolbar still calls `notes[0]` **Fix:** Empty view; guard all `notes[i]` access ## Optimization tips - Prefer value ids over raw indexes across async UI callbacks - `fatalError` in production paths is a smell—use `assertionFailure` + recovery ## What to say in the interview - How you mapped crash stacks to the exact line - How you added a regression check (empty list + rapid tap)

Keep going with AceMobileInterview

Reading helps. Timed practice locks it in. Jump into the interactive track for algorithms with LeetCode links, studio projects, debugging zips, and mobile system design.

iOS trackAndroid trackMore guides