user65909
user65909

Reputation: 121

How to clear/invalidate ambient cache on iOS app

When I update tilesets on mapbox, changes don't appear in the iOS app unless I re-install it. There is seemingly documentation on this here: https://docs.mapbox.com/ios/api/maps/5.2.0/Classes/MGLOfflineStorage.html#/c:objc(cs)MGLOfflineStorage(im)setMaximumAmbientCacheSize:withCompletionHandler: but I can't figure out how exactly to implement it. I don't have an MGLOfflineStorage object because I am not worried about offline map storage right now, I just want to refresh the cache in the app. There are good examples of how to do this in android, but not on iOS. Any help is appreciated (preferably in swift)

Upvotes: 0

Views: 652

Answers (1)

Magnas
Magnas

Reputation: 4064

It appears to be correct to call the methods on the shared MGLOfflineStorage object. The method parameter should be a closure containing any code you want to execute upon completion.

MGLOfflineStorage.shared.invalidateAmbientCache { error in
    print("Invalidated")
}

Naturally you should check the error in the usual 'safe' way.

Upvotes: 1

Related Questions