MapKit setRegion: not preserving span on iPhone

I'm about to pull my hair out over this one. I am trying to restore the map the user was looking at when he last quit the app. When the app quits, I save the center location and the span of the current map. When the app launches again I read in these values and construct a MKCoordinateRegion and set the map's region to this. I've verified this region is correct. However, the map seems to have a mind of it's own. It often approximately doubles the span of the map. It never takes it exactly as I give it. Here is the code that sets the region:
mapView.delegate = self;
CLLocationCoordinate2D coordinate;
coordinate.latitude = settings.latitude;
coordinate.longitude = settings.longitude;
MKCoordinateSpan span;
span.latitudeDelta = settings.latitudeSpan;
span.longitudeDelta = settings.longitudeSpan;
MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, span);
NSLog(@"initializing with latitudeSpan = %2.4f; longitudeSpan = %2.4f",
region.span.latitudeDelta, region.span.longitudeDelta);
[mapView setRegion:region animated:YES];
NSLog(@"after init, latitudeSpan = %2.4f; longitudeSpan = %2.4f",
mapView.region.span.latitudeDelta, mapView.region.span.longitudeDelta);
I can even set the maps's region to the exact same value it already has
[mapView setRegion:mapView.region];
and it still messes up. What's strange is that it doesn't seem consistent in what it is doing. Sometimes it exactly doubles the value and at other times it is some other fraction. I had thought this as just a 3.0 bug because it was working in 3.1. However, now I've found cases in 3.1 where it fails as well (but in different ways).
This is very strange. Has anyone else seen this (or not seen this)? Any solutions?
Message was edited by: btschumy
Message was edited by: btschumy

Hi BT,
I don't have any experience with Map Kit, but since no one else is responding I thought I might offer some of my general experience with bugs that don't appear to be deterministic.
Have you ruled out the possibility that you're applying the saved settings too early? You're setting the delegate in the same code block that restores the region, so it doesn't seem like you're waiting for mapViewDidFinishLoadingMap:. Have you tried restoring the same settings at a later time?
Even if you're sure the settings are being applied at the correct time, my instinct would be to apply them again, perhaps in the next event cycle. In fact I would go so far as to reset the frame and/or bounds of the content view at that time. View controllers have a mind of their own too, and they sometimes diddle with the frame of a content view before it appears. They only do this once however, so I've found a correction in a later event cycle fixes the problem.
Sorry if my lack of MK experience is all too clear, but I didn't want your post to go unnoticed, and a silly response has two benefits: 1) Your thread gets bumped; 2) An expert is more likely to join the thread if you provide a strawman to destroy.
\- Ray
p.s.: Hi Peter! For some reason I didn't see I was actually bumping your question, since BT probably solved the problem weeks ago. - R

Similar Messages

  • HT5824 how can i transfer my notes from my old iphone 3GS to my new iphone 5S/Urgent response appreciated.thanks a lot.cheers

    how can i transfer my notes from my old iphone 3GS to my new iphone 5S/Urgent response appreciated.thanks a lot.cheers

    Contacts should be in your supported computer contacts application.
    Did you sync with your computer befor? Check your computer's Address book/Contacts/Outlook or some other contacts application.
    * Your contacts are part of the backup to preserve recent calls and favorites lists. Back up your contacts to a supported personal information manager (PIM), iCloud, or another cloud-based service to avoid any potential contact data loss.

  • How to resolve error message "iTunes could not back up the iPhone because the backup was corrupt or not compatible with the iPhone. Delete the backup for this iPhone, then try again."

    I inadvertently deleted my iPhone backup on my MacBook Pro. I restored iPhone to factory settings and then synced remotely with iCloud. However the error message repeatedly states:
    iTunes could not back up the iPhone because the backup was corrupt or not compatible with the iPhone. Delete the backup for this iPhone, then try again.
    Any ideas as to how this can be resolved please. Thank you very much.

    My wife's iPhone 5 would not backup, after upgrading to iOS 8.     The "genius" at the Apple store succeeded in DELETING, the only recent backup of her phone so
    recovery became more critical.
    I followed all the procedures for troubleshooting it, but still it would try to backup and then stop due to an error. We particularly wanted to preserve some game data/history/progress that she'd been working on for years.      This game (Dream Fish) would no longer open after the iOS 8 upgrade ... and the phone would not successfully backup, and so we had no confidence that it would restore from an older backup either.       I googled for solution and found Phoneview and iFunBox.      These apps allow you to see & access data files in the iPhone.      Phoneview was too fragile and crashed when copying a file any size.     
    I found "iFunBox".     iFunBox was excellent.      I used iFunBox to recover her game data.    It allows you to make a copy of data files that reside on the iPhone... and store them as a manual backup on the Mac.
    And in the process I found 2 games that caused iFunBox to crash.      The 2 games in question were not important enough to try to keep, so I deleted them from the iPhone.
    So then, I had a manual backup of the important iPhone data, and had eliminated two game files that apparently had a conflict with iOS 8.
    My next Backup attempt was successful.        The iPhone with iOS 8 would now backup to both the Mac and to the Cloud.
    Next I deleted Dream Fish from the iPhone and downloaded a fresh version from the Cloud.    The new Dream Fish with no history opened in iOS 8.
    Then I used iFunBox to copy my wife's Dream Fish data history from the Mac back into the new game.
    Once the transfer was complete, Dream Fish would now OPEN and all of her progress was there and working like normal.
    Hope this helps.

  • HT1351 Some of the songs I bought from iTunes will not sync to my iPhone.  They show up on my phone, but the letters look faed and I can't play them.  How do I fix this?  I tried restoring my iPhone and it didn't work.

    Some of the songs I bought from iTunes will not sync to my iPhone.  They show up on my phone, but the letters look faed and I can't play them.  How do I fix this?  I tried restoring my iPhone and it didn't work.

    Sorry, I meant the letters look "faded" not faed.

  • Trying to sync voice memos I get "was not copied to the iphone because it could not be found"

    I recorded some "voice memos" on my iPhone 5 (iOS 6.1.3). I now just want to get them onto my computer. I have followed the instruction from other posts and selected the "Include Voice Memo" checkbox and also the "Voice Memo Genre" checkbox located on the Music tab. I then click on Sync and get the following error ... "Some of the items in the iTunes library, including ----- were not copied to the iPhone because they could not be found". So I understand that the memos were not copied to the phone ... this is good since I already have then on the phone. I want, instead for them to be copied FROM the phone to the computer. So what's the problem I thought that SYNC'ing meant copying new files from the iPhone to the computer as well as vice versa.
    The Voice Memo is toolarge for me to simply email to myself so I need to understand what is causing this so that I can get around it. I have noticed that when I attempt to "Organize Library" and check "Consolidate Files" (suggested by some forum somewhere) when I close the dialog box and sync again, that when I return to the "Consolidate Files" checkbox i see that has actually cleared itself and is no longer checked. I am not sure if this is related or not.
    I have a very business recording that is on my iPhone and MUST get this audio off the phone ASAP. Any help would be appreciated.
    Sincerely,
    gstenstrom

    The dialog tells you the path to the song is wrong/not there. Make sure you can play it in iTunes.

  • Not receiving texts from iPhone contacts when I'm not connected to wifi or cell data. I can't send and receive regular SMS texts with non iMessage users but iMessage users message are not being converted to text when I don't have internet connect

    I can send and receive to any non iPhone user. I can send a message as a text to an iPhone user but if I'm not connected to cellular data or wifi I do not receive messages from iPhone contacts. From what I understand these message should automatically send to me as texts instead of iMessages but since the update it's not functioning properly. Please help. I've tried turning iMessage off and I still don't receive the messages until after I reconnect to wifi.

    I have the same problem! Before the upgrade, if I wasn't connected to the internet, any messages sent to me from an iphone would convert automatically to a text message. I have payg tarriff, so I turn cell data off, as it costs too much to use it. I have wifi at home and work, but if I'm out and about, I don't receive texts from iphone users until I'm on wifi. I get them ok from non iphone users. There was never any problem until ios7

  • My vibrate does not work on my iphone 4

    My vibrate function does not work on my iPhone 4. Does anyone have any information on this or solution to the fault??
    Any feedback is much appreciated.

    http://www.apple.com/retail/
    make a reservation on top tool bar
    do a back up as if faulty Apple will exchange and your device will go

  • My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    Hello wilsontot_too,
    Thank you for the details of the issue you are experiencing on your iPhone.  It sounds like you are not noticing transparency on your iPhone.  It may be that you have "Increase Contrast" turned on in your iPhone settings.
    I recommend verifying that Increase Contrast is turned off in Settings>General>Accessibility.
    iPhone User Guide - Large, bold, and high-contrast text
    http://help.apple.com/iphone/7/#/iph73b89c6
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • My voicemail does not work on my iphone 5, not receiving messages that leave me

    my voicemail does not work on my iphone 5, not receiving messages that leave me

    any person who will do the same, I communicate with at & t and nothing to do (I left messages in my mailbox I did not receive, nor the iphone notify me

  • My iTunes password does not work on my iPhone...

    My iTunes password does not work on my iPhone, but it does on my MacBook. Why? This is really annoying. How can I solve my problem? I don't even know how to contact Apple.

    dennythepest wrote:
    My iTunes password does not work on my iPhone,...
    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • My proximity sensor does not work on my iPhone 4

    My proximity sensor does not work on my iPhone 4

    Well, it can be fixed, however it is in a very difficult spot, and it may cost me more to replace than what I can get out of it. I don't care to pay for a replacement since my warranty is up, because I already have an iPhone 5. I want to sell the iPhone4, and not for $75 either because you can't make a phone call unless its on speaker. I didn't know what other people had to say, so I just wanted some feedback on my options. I'm sorry that I am not an expert on the iPhone hardware componets, because I actually work for a living. I don't have time to sit here and play on forums. Thanks for all you're help.

  • ITunes match does not work on my iPhone 4S, but is working across all of my other Macs and iOS devices.  All other iCloud services are working fine on the 4S - any suggestions?

    iTunes match is not working on my iPhone 4S; it works awesome across all of my Macs and other iOS devices (iPad 2, iPod Touch 4g x 2, and my wife's iPhone 4).  Any suggestions?  Thanks!

    It is not possible to "toggle back and forth" at will. If you associate a device with an Apple ID and you have iTunes Match enabled you must wait 90 days before you can associate it with another Apple ID. See this Apple KB article for more information: http://support.apple.com/kb/HT4627

  • My total amount of DOWNLOADED APPS. do NOT show up on iPhone HOME pages.

    My total amount of DOWNLOADED APPS. do NOT show up on iPhone HOME pages.
    I have the BIG DOG 16 gig iPhone and I am only limitted to 9 pages of APPS.
    For what I PAID for this GREAT Phone, there should be NO LIMIT as to how many APPS. that I can download until and UNLESS my memory is FULL, which it is NOT even half full yet.
    APPLE: Please change this LIMITATION, because there seems to be thousands of APPS. to choose from. Just as you have NO-LIMIT on the number of songs that I can download, I would like it to be the SAME for my APPS.
    Thank you.

    This ***** badly
    http://discussions.apple.com/thread.jspa?threadID=1807300&tstart=0

  • ITunes 11.1.5 will not sync to my iPhone 5

    Hello,
    My music will not update on my iPhone. It always looks like it is, but it isn't. For example, I added a playlist and I can't get it on my iPhone, but when I click the "on this iPhone" button it looks like it IS on my phone, but it isn't. I've tried the following (some more than once) and rebooted my phone after each attempt:
    - Unchecking the box to sync all my music to wipe it all off, then re-checking the box and re-syncing it. That didn't work.
    - Deleting all the music off my phone through the settings>usage menu. Re-syncing it to add music back. That didn't work.
    - Dragging the playlist to the iPhone device. Again, it shows like it's there on iTunes but it's not.
    The best part is that when I sync my phone, it keeps getting stuck on step 4 most of the time.
    What am I missing?
    Running OS X 10.8.5 on MacBook Air.

    Purchase the Snow Leopard install DVD from Apple to install 10.6
    After that uodate to 10.6.8 using Software Update

  • I've purchased songs thru iTunes Store and they will not sync to my iPhone 5.  They show up as if they are in the cloud but wont download to my iPhone, Why?

    So some of my purchased songs from iTunes are not syncing to my iPhone.  Is there a setting or format issue?  If so, how do I change it?  The songs show up on my iPhone as if they synced, but do not play.  There is an icon to the right saying it needs to be downloaded from iCloud and when I click it, it wont download.

    See this older thread for a few possible solutions.
    https://discussions.apple.com/thread/3924425?tstart=30
    B-rock

Maybe you are looking for

  • Brand New MacBook Pro Cannot Connect to Airport Express

    Hi all, Been reading through these pages and I think there are many others with the same problem as me but with no real answer, I thought it wouldn't hurt to ask anyway. I have an Airport Express which I bought a couple of years ago. It initially wor

  • MBP and target disk mode with PPC desktop

    I am thinking about finally jumping to a MBP from a PowerBook. One of the things I do a lot is hook up my PowerBook in target disk mode to interchange information with my PowerPC desktop. Any problems with using a MBP in target disk mode with a PPC d

  • While using Photoshop, my printer will only print a redish tinted photo

    I use windows7. I am able to manipulate phots with the cs5 . However, when I want to print the photo, I am only able to get a redish tinted photo. It looks like a sepia toned print except it has a redish or burgandy color. It does not matter if I sel

  • IPod Touch 4G Won't Connect to Wifi?

    Hey all. So, recently I got a new iPod Touch 4G. Just four days after, it fell out of my pocket (I fell as well) and cracked, big time. On the top left, there's a lovely hole where I can see the "insides". I've had it for about two months now, and st

  • CS6 fails to import Canon .mxf files. In CS5.5 it works always great.

    On CS6.01 I can not import Canon mxf video footage. There is always import failure message window. Same result if I copied CF Card to Hard disc. On CS5.5 it works always great. I have both premiere versions on same computer: Camera: Canon XF100 Size: