ios定位零误差,应用极其简单的方法

http://www.zdoz.net/

 

用的是第三方MMLocationManager.h 和.m

可以下载 MMLocationManager-master.zip看效果。。。goHome.zip是以前的笨方法。

用的时候就一个方法。。。

-(void)getLat

{

    __block__weakTestViewController *wself = self;

    [[MMLocationManager shareLocation] getLocationCoordinate:^(CLLocationCoordinate2D locationCorrrdinate) {

        [wself setLabelText:[NSString stringWithFormat:@"%f %f",locationCorrrdinate.latitude,locationCorrrdinate.longitude]];

    }];

 

}

 

 

 

 

 

另外如果想获取城市名什么的要下面的方法就OK

 

-(void)getCity

{

    __block__weakTestViewController *wself = self;

    [[MMLocationManager shareLocation] getCity:^(NSString *cityString) {

        [wself setLabelText:cityString];

    }];

}

 

-(void)getAddress

{

    __block__weakTestViewController *wself = self;

    [[MMLocationManager shareLocation] getAddress:^(NSString *addressString) {

        [wself setLabelText:addressString];

    }];

}

 

-(void)getAllInfo

{

    __block NSString *string;

    __block__weakTestViewController *wself = self;

    [[MMLocationManager shareLocation] getLocationCoordinate:^(CLLocationCoordinate2D locationCorrrdinate) {

        string = [NSString stringWithFormat:@"%f %f",locationCorrrdinate.latitude,locationCorrrdinate.longitude];

    } withAddress:^(NSString *addressString) {

        string = [NSString stringWithFormat:@"%@\n%@",string,addressString];

        [wself setLabelText:string];

    }];

 

}

 

 

 

 

 

猜你喜欢

转载自zhangmingwei.iteye.com/blog/2017385