Saving a mapview in iOS

Hi, I am currently trying to build a running application where I want user to have a look at their running journey on a map for which I would to save it. I have come across an option of MKMapSnapShot but failing to find any example of how to implement it. If someone has an idea and they are willing to share, it will be great! Thanks.

Hi ! Did you look at these tutorial in Ray Wenderlich :
https://www.raywenderlich.com/73984/make-app-like-runkeeper-part-1
raywenderlich.com/97945/make-app-like-runkeeper-swift-part-2

I followed the original tutorial by Matt Luedke in Objective-C and it was great, this update in Swift by Zouhair Mahieddine looks the same according to the screenshot.
Once the running record is made, you can compute the region of the map needed to display it entirely using the mapRegion() function from part1 of this tutorial.
Then, you can save a screenshot of your map using MKMapSnapShot in order to be able to load it without internet connection.
This tutorial from NSHipster show how to use it : MKTileOverlay,MKMapSnapshotter &MKDirections - NSHipster

If you don’t ask, you won’t find out if anyone can help. What’s making you stuck?

Sorry for the delay, Easter Weekend in family ^^
Where are you actually stuck ? I followed the Objective-C version of this tutorial and it went fine, maybe I’ll remember it :wink:

Hi, Thank you for coming back and I hope you had a good Easter weekend! Earlier question was regarding core data but after reading and trying bit of realm I am finding it comparatively a lot easier than Core data.
I am currently trying to figure out this:
a) I have a table view with dynamic cells where a new cell is created at midnight which is working fine. :slight_smile:
b) Tapping on cell leads to a new screen with static cells storing fitness data which is recorded till midnight as well and then gets refreshed to 0.

But currently, when a new cell is created earlier data is washed out :frowning: . I understand that I have to save them, but do I have store them against date and fetch them back when user taps on cell or is there any better way?

Ok so if I understand correctly, you have UITableViewController objects (or UIViewController with tableview in it), and the issue appears when a new cell is created for the first one ?

Tapping on cell leads to a new screen with static cells storing fitness data which is recorded till midnight as well and then gets refreshed to 0.

I didn’t understand the part highlighted, what to you mean by refreshed to 0 ? For the tableview or for the cell ?


You should add the code you use when you create a cell if you want further help, because we can’t help you otherwise.