IOS8 amap sdk MAMapView cannot be located. ios8mamapview

Source: Internet
Author: User

IOS8 amap sdk MAMapView cannot be located. ios8mamapview

On iOS8 devices, you can use amap sdk to find that the callback position in MAMapView is empty.

-(void)mapView:(MAMapView*)mapView didUpdateUserLocation:(MAUserLocation*)userLocation updatingLocation:(BOOL)updatingLocation{    CLLocation *currentLocation = userLocation.location;    if (currentLocation) {    }}

CurrentLocation on iOS8 is empty, leading to locating failure. We know that Apple has greatly optimized its positioning on ios8. it can support indoor positioning, frequent location statistics, and floors.

Autonavi fails because it does not adapt to ios8.

Solution:

1. Add NSLocationWhenInUseDescription and NSLocationAlwaysUsageDescription to info. plist of the project. Different fields correspond to different methods.

2. Declare a private CLLocationManager variable in AppDelegate. m. The Code is as follows:

@interface AppDelegate()<CLLocationManagerDelegate>{    UINavigationController *_navController;    CLLocationManager      *_locationmanager;}@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{    [UIApplication sharedApplication].idleTimerDisabled = TRUE;        _locationmanager = [[CLLocationManager alloc] init];    [_locationmanager requestAlwaysAuthorization];        //NSLocationAlwaysUsageDescription    [_locationmanager requestWhenInUseAuthorization];     //NSLocationWhenInUseDescription    _locationmanager.delegate = self;}

In this way, the callback in the MAMapView

-(void)mapView:(MAMapView*)mapView didUpdateUserLocation:(MAUserLocation*)userLocation updatingLocation:(BOOL)updatingLocation
You can get the user's current location normally. In this case, userLocation. location has a value.


Why gps cannot be located on AMAP?

Generally, GPS positioning is irrelevant to the map used. In addition, the landlord described at home a few tens of meters deviation, a go out of the positioning is not GPS positioning, But Mobile Communication Base Station or WI-FI positioning.
HTC's GPS positioning for the first time often takes some time. You need to stay in a static state for more than 3 minutes, or even 10 minutes, where you can see at least 1/3 hemisphere sky (must be the sky, not the building outside the window, can be located. If you want to locate the location as soon as possible, you can select enable secondary GPS (some mobile phones call quick GPS) and enable GPRS data access, which can significantly shorten the GPS search time.
After the first positioning is completed, the positioning speed will be faster.

Hello, my 9100 won't be able to be located when I use Google Maps. Although AMAP can be located, it is not accurate and located at 5 kilometers. What should I do?

There are too many reasons why mobile phone GPS cannot be located smoothly. We suggest you install a gps test to TEST whether a star cannot be found or the location cannot be found, in order to find targeted solutions
 

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.