Map location Error Exception: ' Invalid region

Source: Internet
Author: User

1 Do map positioning today, find this problem, call the following function, there is a problem

  Mkcoordinateregion region = Mkcoordinateregionmake (_currentlocationcoordinate, Mkcoordinatespanmake (ZoomLevel, Zoomlevel));   [_mapview Setregion:[_mapview regionthatfits:region] animated:yes];


Exception: ' Invalid region <center:+inf, +0.00000000 span:+1.00000000, +0.50000000> ' when trying to display the map
2 degrees Niang a bit, the original is out of range, plus range judgment
if ((Region.center.latitude >= -90) && (region.center.latitude <=) && (region.center.longitude >= -180) && (region.center.longitude <=)) {        [_mapview setregion:[_mapview regionthatfits:region] Animated:yes];    }    else{        NSLog (@ "Invilid region");    }



3 The fundamental, data error, and later found the reason, latitude 118, wrong, has exceeded the range-90<=latitude<=90 -180<=longtitude<=180

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Map location Error Exception: ' Invalid region

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.