Skip To Content ArcGIS for Developers Sign In Dashboard

Finish using an offline map

When you have finished using a mobile map package we recommend that you remove the mobile map package, to free up disk space on your device, and remove replicas on online feature services. You should:

  • Unregister any geodatabases that are no longer required for synchronization.
  • Close all mobile map packages that are no longer required.

Unregister a geodatabase

Geodatabases are registered with an online sync-enabled feature service to ensure that any of their feature updates can be synchronized with the feature service. A geodatabase is registered automatically when you:

You can also register it manually. If you do not intend to edit and synchronize your changes or you have stopped work with this geodatabase then you should unregister the geodatabase from the online feature service. Unregister removes the geodatabase's replica ID from the service so it can no longer be synchronized. You need to do this when your device is online and before you delete the mobile map package.

syncTask = AGSGeodatabaseSyncTask(url: featureServiceURL)

syncTask.unregisterGeodatabase(generatedGeodatabase){ (error: Error?) in
 if let error = error {
  print("Error while unregistering geodatabase: \(error.localizedDescription)")
 }

You can perform this operation later if your device cannot be online when you delete the mobile map package. Obtain the Sync ID from the geodatabase, store this and use this to unregister the geodatabase when your device is online.

let syncID = generatedGeodatabase.syncID

syncTask = AGSGeodatabaseSyncTask(url: featureServiceURL)

syncTask.unregisterGeodatabase(syncID){ (error: Error?) in
 if let error = error {
  print("Error while unregistering geodatabase: \(error.localizedDescription)")
 }

Close the mobile map package

When a mobile map package is loaded and used by a Runtime app, the operating system will lock the underlying mobile map package file or unpacked package files until the memory is freed or garbage collection runs (depending on the platform). These locks prevent files from being inadvertently moved or deleted. We strongly recommend that you close a mobile map package if you need to move, delete or reopen it while the application is running. Reopening a mobile map package may be required after applying scheduled updates. Close the mobile map package, as follows

  1. Stop using the mobile map package. Remove the map from the map view. Remove all references to the mobile map package including maps, layers, geodatabases, networks, locators, etc.
  2. Call the mobile map package's close method to free its locks. If active references to mobile package data exist, the close method will still close the package and subsequent rendering and data access methods will fail.
  3. The underlying mobile map package file or directory can be moved or deleted and/or the app can be terminated.
self.mobileMapPackage.close()

Next

When you have released all references to the contents of the mobile map package and closed it you can close your application and delete or move the mobile map package, if required.