The space-mapping state and set of anchors from a world-tracking AR session.
- iOS 12.0+
The session state in a world map includes ARKit's awareness of the physical space the user moves the device in (which ARKit uses to determine the device's position and orientation), as well as any
ARAnchor objects added to the session (which can represent detected real-world features or virtual content placed by your app).
Serialize and Deserialize a World Map
When your app is quitting, you can save the current world map (acquired using
ARWorld conforms to
NSSecure, you serialize it using
To restore the world map the next time your app launches, use
You can use anchors from a resumed world map to place the same virtual content at the same positions from the saved session, if the app is launched in the same physical environment.
For more information, see Saving and Loading World Data.
Share a Saved World Map
With two devices tracking the same world map, you can build a networked experience where both users can see and interact with the same virtual content. To send an
ARWorld to another device, creating a shared frame of reference for multiuser AR experiences:
On one device, use
NSKeyedas in to convert the world map to a data object. (You don't need to write the data to a file to send it over the network.)
Use the networking technology of your choice to send the resulting data to another device. (For example, in a MultipeerConnectivity session, call
sendto send data, and implement
Data: to Peers: with Mode: error:
MCSessionmethods on the other device to receive data.)
For more information, see Creating a Multiuser AR Experience.