Skip to main content
←API Reference ←NSDK ←NSDKVps2Session

trackAnchor


Declaration​

func trackAnchor(payload: String) throws -> NSDKVpsAnchorId

Summary​

Requests to start tracking an anchor specified by a payload.
Use this only to restore an AR anchor the app created itself with
createAnchor(at:) and saved from anchorPayload(anchorId:) or
createdAnchorPayload.
The returned anchor ID is automatically polled each frame via update(), and updates
are published on anchorUpdated.

Returns​

The unique identifier of the anchor encoded in the payload.

Throws​

  • NSDKError.invalidArgument if the payload is not valid.
Notice

Warning: An anchor payload is no longer the preferred method to identify the map to localize against. Target a map by site ID with localize(siteId:) or by coordinate with localize(latitude:longitude:radiusMeters:). An anchor is tied to the site asset it was created against, so it will not resolve against a different site or a different asset of the same site.

Parameters​

NameTypeSummary
payloadString
Base64-encoded anchor payload.