1

I am trying to save an ARWorldMap using persistence and save the session to Firebase Realtime Database. The data from ARWorldMap is of type NSArchivedData but Firebase can only save data of type:

  • NSString
  • NSNumber
  • NSDictionary
  • NSArray

How can I convert the NSArchivedData to any of the types above and extract the data from Firebase to restore the world map session? We have tried to convert the data into a string (using UTF-8 format), but it seems like we are loosing data.

Best regards, Casper

Casper Lindberg
  • 600
  • 1
  • 6
  • 21

2 Answers2

1

I hope this will help you to archive the world map

let data = try NSKeyedArchiver.archivedData(withRootObject: worldMap, requiringSecureCoding: true)

and then try saving it on firebase storage and get the download url and save the download url in the firebase Firestore/RealTimeDatabase. After that you can download it on any iOS device compatible with ARKit and unarchive the downloaded worldmap and show it in the sceneView.

0

You can't.

However, you can save the Data in Firebase Storage and then save its URL as a reference in the realtime database.

Rom4in
  • 532
  • 4
  • 13