SetRegion does not update the region when the current one is slightly diff.

I'm working on some iPhone MapKit code which fires off some events when the boundaries of the map change (basically some queries to an external server). There is one edge case I can't seem to solve. When users enter a new address I use setRegion to zoom in on that location and afterwards I compute the bounds of the map and query my external server with those coordinates. I always call setRegion however, there is one edge case when it will not fire. That, is, when a user magically happens to select the exact same address that lies at the current center of the map, when that map is zoomed to exactly the same region. Of course this possibility is rare but it is easy achievable in code.
This would be the equivalent of allowing the user to drop a pin at the center of the current map and fire off a query to my server based on that. Unfortunately because the code logic depends on the region changing (which I've done so that users can easily pan around the map and not have to explicitly press a refresh button), I need a work around. How can I know when setRegion has been called but it won't fire regionWillChange / regionDidChange. Can I override the function some how?
As a work around I tried to detect when the region wouldn't change by writing code just before I set the region to compare the new region's center coordinates and span values to that of the current map region's.
Unfortunately when I set the search Location to be the center of the current map I get the following results:
diff in latitude of center 0.000000
diff in longitude of center 0.000016
diff in latitude span -0.000000
diff in longitude span 0.000000
In different cases the error is slightly different but generally speaking even when the region is slightly different like this setRegion or morever, regionDidChange, do not fire. Can anyone explain why? Or how I could go about detecting this properly. Note: I also tried with mapView.centerCoordinate but I get similar errors, and I only want to know when the region will NOT change (if the centerCoordinate is the same the zoom level / region can still be different).

I realized the code was not included. That should make my question clearer
CLLocation *centerOfMap = [[CLLocation alloc] initWithLatitude:mapView.centerCoordinate.latitude longitude:mapView.centerCoordinate.longitude];
mySearchLocation.searchLocation = centerOfMap;
//Recenter and zoom map in on search location
MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
region.center = mySearchLocation.searchLocation.coordinate;region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[self.mapView setRegion:region animated:YES];
And:
//Recenter and zoom map in on search location
MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
region.center = mySearchLocation.searchLocation.coordinate;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
region = [mapView regionThatFits:region]; //Not sure if this is necessary
NSLog(@"diff in latitude of center %f", (mapView.region.center.latitude - region.center.latitude));
NSLog(@"diff in longitude of center %f", (mapView.region.center.longitude - region.center.longitude));
NSLog(@"diff in latitude span %f", (mapView.region.span.latitudeDelta - region.span.latitudeDelta));
NSLog(@"diff in longitude span %f", (mapView.region.span.longitudeDelta - region.span.longitudeDelta));
[self.mapView setRegion:region animated:YES];

Similar Messages

  • I have iCloud on my iMac, macbook and iPhone.  However, when I update my contacts on one, it does not update on any of the other devices.  The calendar seems to be working.  Any suggestions?

    I have iCloud on my iMac, macbook and iPhone.  However, when I update my contacts on one, it does not update on any of the other devices.  The calendar seems to be working.  Any suggestions?

    On the iMac and MacBook open System Preferences > iCloud
    Deselect the box next to Contacts, then reselect it then restart the Macs.
    On the iPhone tap Settings > iCloud
    Switch Contacts off then back on then restart the iPhone.
    Hold the On/Off Sleep/Wake button down until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.

  • Macbook Pro 2011 DVI HDMI out does not work with TV when the power cable is connected

    My Macbook Pro (Early 2011) DVI HDMI out does not work with TV when the power cable is connected. If get the blue screen and then can use the macbook but nothing is displayed on the TV. If i go into display I can see that there are two screens but nothing displayed on the TV. If i take the power cable out at this point the TV shows the second desktop as expected. If i then reconnect the cable, the screen flickers, as though it is being affected by the power cable, and the screen goes blank on the TV. Only if i remove the DVI cable do i get the blue screen again. If i remove the power cable and reconnect it will do it every single time, so i cannot see it being a TV issue or a minor glitch.
    I have had this working previously but at the minute it seems to not be playing ball....any thoughts
    Thanks
    Dan

    BUMP
    Any ideas?

  • I cleared the cache and my site does not update!  What's the secret?

    I cleared the cache and my site does not update! What's the secret? I created a second website and bought a domain name. You can get to the site by it's mac name or the purchased domain name. I linked the domain name and with my server and it works. The site comes up wither way. BUT, either way, I cannot get my changes to appear. I had realized that my links were not working because I had placed them within the header. So, I moved the links out of the header, republished, and now the new pages (with links in body of website) will not load. Here are the two ways to get to see the site. Both show the old way (links in header). What is up with me not being able to see the changes in either Firefox or Safari?
    http://www.frankysoldiesbutgoodies.com/
    http://web.mac.com/musbegin/iWeb/OldiesButGoodies/OldiesButGoodies.html
    Thanks,
    musicalbeginnings

    hello mccormick.lee, please try downloading the full setup file for the current firefox version from https://www.mozilla.org/firefox/all/ and install it on top of your current installation.

  • Java does not update older version when installing from MSI file

    I'm using an MSI file of Java because it's easier for deploying through SCCM. Anyway when I do everything works fine except it does not update older versions of Java. So for instance if I have Java 7 update 7 and install Java 7 update 21 using the MSI file I'll then have two versions of Java installed on my computer. Anybody know a way to install using the MSI file where it updates older versions of Java (as long as it's the same major revision) like the exe would?

    Yes same problem here. I had a successful rollout with the MSI package and version 1.7 Update 17 on 1500 computers!
    I packaged the Update 21 and on my first test-clients the control panel crashes when I try to open it. But the setup ends successful without any error code all eventviewer entries are successful and it seems that the environment is running. Firefox plugintest was successful.
    Why doesn't offer Orcale the MSI files?! Since last year Java cost me o lot of time deploying Java. There is no update which you can release quickly because there are always bugs to deploy them.

  • Itunes does not update playlists properly on the ipod touh 4g - help??

    Hi Guys,
    Newbie here. Thanks for the help in advance.
    I have an ipod touch 4g with the latest 5.1 OS update and the latest itunes installed 10.6.1.7 on my computer.
    I usually make and edit playlists on my computer/itunes and then sync it with the ipod.
    Lately what itunes has started doing is that it syncs the songs and other things like i want to but when it comes to playlists it will either sync playlists to the ipod with a couple of songs missing from the original playlists or only a couple of songs or just a playlist with no songs . The playlists look fine on the itunes but not on the ipod. The songs are physically there on the ipod and it syncs them fine but not the playlists. Some playlists are okay other are not. No consistency. Sometimes this and sometimes that.
    Has anybody got any ideas why it is likely doing this?? software screwup?? some option that i am not selecting or something??

    okay, I don't know about the rest, but about the songs never actually loading onto your iPod, I found in another discussion how to fix that. I'm using Windows 7, so I don't know if the steps are the same, but the end result is the same. So go into your Start menu, then into accessories, right click 'Command Prompt' and click 'Run as administrator'. Then type in the following: netsh winsock reset then press Enter. After a few seconds it should tell you to to restart your computer for changes to take effect. Restart your computer, then restart iTunes, then everything should be working fine. It still takes forever sometimes to update the iPod, but eventually it will work. I've had to do this multiple times, so I'd suggest copying & pasting this solution into a notepad or Word document and saving it on your computer, so you don't have to go through the discussions again to find it. This tends to happen to me nearly every day unfortunately Hope this fixes that problem, but I'm not having any of the other problems fortunately, except for removing the artwork of the songs it updates without me asking it too. PS I think my problem may be with iOS 5, because iTunes 10.5 came out before iOS 5, and I think everything was fine before I updated my iPod, but I really don't know where the problem lies

  • HT1386 when i plug my iphone 4s into my computer is does not show in itunes,  When the menu comes up on my computer for what action I want to take it shows no options for itunes.  My phone worked before, Im not sure why it is not working now??

    I just recently tried to plug my iphone 4s into intunes.  It comes up with the menu of what action do you want to take.  My only options only involve photos and videos nothing to do with syncing or music.  When I open itunes it does not even show my device in itunes.  What do I do??

    uninstall itunes
    you may have to manually delete anything related to itunes in regedit
    reboot and reinstall itunes

  • How come my latest version of firefox does not show identification flags when the arrow or finger is on an item such as a link

    using Internet Explorer or when using I.E. through AOL; when I place the cursor/arrow/finger over many links , PIX, buttons, etc. ... a flag comes up (much like the ones that ID a function on my desktop) that tells me what the link , PIC, etc. is.
    When using Firefox that feature does not work... even on the same icon,link, etc. that works just fine without Firefox. I like these ID Flags and have grown to depend on them over the years. How can I implement this "ID flag" using Firefox.?

    unfortunately the fiddler2 issuer in certificates might be a sign of unwanted software present on your pc that is intercepting secure network traffic. please go into the system control panel and uninstall programs like BrowserSafeguard, BrowserSafe, SafeGuard or other software that sounds suspicious and didn't get installed by you intentionally.
    <br><sub>reference: https://support.mozilla.org/en-US/questions/982532#answer-520145</sub>
    afterwards, run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] & [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner].
    [[Troubleshoot Firefox issues caused by malware]]

  • Create Upgrade Evaluation Site Collections Timer Job does not send notification Email when the Site is created

    Hello Everyone,
    My problem is:
    The Create Upgrade Evaluation Site Collections job does not send a Notification Email when the Eval Site is created. I only get a notification E-Mail that mention that a Upgrade Evaluation Site Colletion is requested and then after 27 Days that the Evla
    Site will be deleted in three Days.
    My Enviroment:
    SharePoint Foundation 2013 Sp1 on Windows Server 2012
    Exchange 2010 SP3
    I hope someone can help.
    best regards
    domschi

    Hi domschi,
    As I understand, you didn’t receive email generated from Create Upgrade Evaluation Site Collections timer job. While you might receive email generated from Delete Upgrade Evaluation Site Collections.
    When you request an evaluation site collection, the request is added to a Timer job
     which runs once a day. You will receive an e-mail message when the upgrade evaluation site is available. This might take up to 24 hours. The message includes a link to the evaluation site. Upgrade evaluation site collections are set to automatically
    expire (after 30 days by default).
    Please go to CA > Monitoring > Review Job Definitions, locate issue timer job and click Run Now. Then go to Job History and check if the issue job failed to run.
    Also, please check if the email are received by Exchange Hub server.
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Iphoto does not recognize video files when the iphoto library is on an external drive

    I have copied my iphoto library to an external hard drive. I pointed iPhoto to the new location. I can import photos with no problem, but when I try to import video files (from my iPhone or from another drive) I get a message that the file is not recognized. When I moved the iphoto library back to the MAC hard drive, the import works OK both for photos and videos.
    I am using iphoto 11 and all the videos were taken with my iphone.
    Any ideas?

    Video could be imported from an iPhone before the library was copied to an external drive.
    The video that was imported before the library was moved could be read before and after the library was moved to an external drive.
    Video from the same iPhone cannot be imported into the library once the library had moved ton an external drive.
    The problem is that video can no longer be imported into the library that was moved to an external drive. Photos from the same iPhone can be imported and read.

  • SWF linked by reference in FM does not update in RH when FM files are updated

    Hi all, using TCS2 on WindowsXP.
    I have a FM book with a Captivate SWF linked by reference. When I link my FM book into RH, all works nicely. But here's the catch - when I change something in my Cativate project and re-publish the swf (to update the old swf), although the FM SWF updates to the new one, RH does not. The SWF found in RH is the one from the original instance of linking the FM book.  This is an issue as it seems to be hampering my 'single sourcing' world.
    Any thoughts?
    Thanks,
    Adriana

    HI there
    Are you able to just delete the SWF from RoboHelp? I'm thinking that if you could do that, the SWF would simply have to update from FM as it wouldn't be found any longer.
    I do realize it's a kludge and things should simply just *WORK*, but we do live in an imperfect world.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Photoshop CC: Save For Web function does not update filesize previews when I change filetypes

    I recently tried to save some web banners and wanted to optimize for smallest filesize with best looking output, and as I changed filetypes from Gif to Jpeg to PNG, the preview at the bottom of the window that usually updates with estimated filesize was not changing and the preview image would not change as well. The issue made it impossible to predict the output and required that I actually save in all the variations, then reopen them to see the end result.
    My software is up to date.
    Not really sure what it can be.
    Please help.
    Casey

    Same issue. Hoping someone responds to this thread soon

  • .SubmitChanges does not update foreign key to the database

    My problem occurs in a Windows Phone 8.1 Silverlight VB application. The CatDataContext defines a table Books with items Title and a foreign key _seriesID, with belongs to a table Series.
    Updating of the field Title alone, or the fields Title and _seriesID works fine. However when I only change the _seriesID then no update of the underlying database is done. In this case .GetModifiedMembers shows no modifications.
    A demo project with this problem is available.

    Your demo project url is missing, check it.

  • Photo library does not update on iphone when synced

    the latest images from iphoto do not sync with the iphone/ipad when plugged in to Imac.

    Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new).  Try each of these in order until the issue is resolved.

  • My firefox does not update automatically. When I go to help and hit check for update it tells me update server not found check internet connection

    I am not able to watch videos on firefox. They said to check for updates

    Try updating using an iTunesSetup.exe (or iTunes64Setup.exe) installer file downloaded from the Apple website:
    http://www.apple.com/itunes/download/

Maybe you are looking for