◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/Dev Tools
⬡ Dev Tools/2026-07-18Advanced

Your AR Furniture Is Gone by Morning — Persisting Placements with ARWorldMap

AR apps generated by Rork Max lose every placed object on relaunch. Here is the design that fixes it: when to save an ARWorldMap, how to encode custom anchors, how to handle the relocalization wait, and what to do when relocalization simply never lands.

Rork Max236ARKitARWorldMapSwift48indie development42

✦ Premium Article

Ask Rork Max for an AR app that places furniture on the floor, and it hands you something that works on the first run. Session setup, plane detection, tap-to-place — all of it, without writing a line of Swift yourself.

The trouble showed up the next morning.

I closed the app after placing a few pieces, reopened it the following day, and every single object was gone. Not a bug. An ARKit session remembers nothing unless you tell it to. After years of shipping wallpaper apps as an indie developer, I thought I had a decent nose for missing persistence — but AR moved the goalposts. Saving coordinates is not enough.

What follows is the design that fills that gap.

Why saving coordinates does not bring anything back

The instinctive fix is to serialize each tap's simd_float4x4 to JSON. It does not work, because the coordinate system itself is rebuilt from scratch every session.

ARKit places the world origin wherever the device happened to be when tracking started. Launch near the doorway yesterday and beside the sofa today, and identical numbers now point meters apart. Coordinates only mean something alongside the map that interprets them.

That map is ARWorldMap, and it holds three kinds of things:

ElementWhat it isSaved?
Feature pointsThe point cloud the camera has recognized (rawFeaturePoints)Yes
AnchorsYour ARAnchor list — transforms and identifiersYes
3D modelsThe meshes and materials you are renderingNo

That third row costs people a night. ARWorldMap remembers where. It never remembers what. Restore it naively and your anchors come back to an empty screen.

Giving anchors something to say

The fix is to subclass ARAnchor and carry your own payload. World map archiving encodes anchors too, so a correct NSSecureCoding implementation ships your model identifiers along with the map.

final class FurnitureAnchor: ARAnchor {
    // The key that decides which model to rebuild on restore
    let catalogID: String
    let placedAt: Date
 
    init(catalogID: String, transform: simd_float4x4) {
        self.catalogID = catalogID
        self.placedAt = Date()
        super.init(name: "furniture", transform: transform)
    }
 
    // ARKit calls this whenever it copies an anchor inside a session.
    // Skip it and your payload is gone before it ever reaches disk.
    required init(anchor: ARAnchor) {
        let other = anchor as! FurnitureAnchor
        self.catalogID = other.catalogID
        self.placedAt = other.placedAt
        super.init(anchor: other)
    }
 
    override class var supportsSecureCoding: Bool { true }
 
    required init?(coder: NSCoder) {
        guard let id = coder.decodeObject(of: NSString.self, forKey: "catalogID") as String? else {
            return nil  // Older maps: refuse rather than restore garbage
        }
        self.catalogID = id
        self.placedAt = coder.decodeObject(of: NSDate.self, forKey: "placedAt") as Date? ?? Date()
        super.init(coder: coder)
    }
 
    override func encode(with coder: NSCoder) {
        super.encode(with: coder)
        coder.encode(catalogID as NSString, forKey: "catalogID")
        coder.encode(placedAt as NSDate, forKey: "placedAt")
    }
}

When I layer this onto generated code, init(anchor:) is the first thing I check. Leave it out and everything looks fine during the session — only the saved map comes back hollow. You cannot catch that without closing the app on a real device, which makes it the single easiest thing to miss in a code review.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Find out why AR placements vanish on relaunch, and add ARWorldMap save/restore in roughly 60 lines of Swift
✦Sidestep the two traps that silently destroy saved data: mappingStatus timing and NSSecureCoding on custom anchors
✦Ship an escape hatch for the 30-second relocalization failures that otherwise read as a frozen app
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-05-17
Testing Rork Max SwiftUI Features on a Real Wallpaper App — What Worked, What Needed Fixes
I benchmarked Rork Max's SwiftUI generation against the production code of a wallpaper app I actually run. Here is what shipped as-is, what needed fixing, and what I ended up writing by hand — with working code and on-device measurements.
⬡ Dev Tools2026-04-05
Rork Max × WidgetKit & Live Activities in Practice — From Home Screen to Dynamic Island
A complete guide to implementing iOS Widgets, Lock Screen widgets, and Dynamic Island Live Activities with Rork Max. Covers WidgetKit fundamentals, Timeline update strategies, App Intents integration, and monetization.
⬡ Dev Tools2026-09-19
Reading only what Rork changed: the diff routine I run after every re-export
How to read a fresh Rork export as a diff against the last one: clear tracked files before you copy, strip the noise before you count, and stop once before the merge commit lands.