MapKit in Airplane Mode

MapKit in Airplane Mode



I have 30 MKPinAnnotations on a map in my area. I also have a series of arrays of 30 more locations relative to each of those 30. The experience I want is to be able to tap one of those pins, and the other 30 relative pins show up around it. When I do everything with full internet connectivity, this is the result:


MKPinAnnotations



enter image description here



I am using Realm to cache everything on the backend, so I know I have the data available to me. Tapping the blue pin brings up a callout view that allows me to "check in" to this location, which should summon the 30 other relative locations. This is the code that drops my pins for me:


if let annotations = currentRestaurantAnnotations
mapView.removeAnnotations(annotations)

currentRestaurantAnnotations = nil
currentRestaurants = nil
var restaurantPins = [RestaurantAnnotation]()
for restaurant in restaurants.filter( $0.venueID == currentFocusVenue?.id )
let pin = RestaurantAnnotation(coordinate: CLLocationCoordinate2D(latitude: restaurant.latitude, longitude: restaurant.longitude), title: restaurant.name)
restaurantPins.append(pin)

currentRestaurantAnnotations = restaurantPins
mapView.showAnnotations(restaurantPins, animated: true)



Again, debugging on this when I have connectivity, all of the annotations make it to the last line. When I put the device in airplane mode, and I tap the blue pin and its callout button, this method gets triggered again, and everything runs in the code as it should, but after showAnnotations() runs, the map view shows no annotations.


showAnnotations()



For context, if I then take the device out of airplane mode, the app does what it should by triggering an update from the cloud of those 30 relative locations. This function to show the annotations is triggered again, and the annotations all show because my device is in airplane mode.



Tl;dr: how do I make annotations show up on MapKit when my device is in airplane mode?





are you using a high accuracy for gps that depend on internet/wifi ? that could be one of the reasons...... try to change accuracy to low.
– DeyaEldeen
Aug 28 at 18:18





Your asking this question like it's a map issue but it sounds like it's a realm issue. You may want to rephrase your question to be more Realm specific.
– Clever Error
Aug 28 at 18:26





@DeyaEldeen ok I'll try that!
– dokun1
Aug 28 at 18:29





@CleverError sorry but that's not the case - the data comes from Realm well formed in airplane mode, and when I make my collection of MKPinAnnotations, those are formed the same too. When I try to showAnnotations, the pins do not show up. I am very confident this is not a Realm issue.
– dokun1
Aug 28 at 18:31



MKPinAnnotation


showAnnotations





Have you tried using addAnnotations with setVisibleMapRect instead of showAnnotations?
– Luke Van In
Aug 28 at 19:11


addAnnotations


setVisibleMapRect


showAnnotations









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)