第三方框架 INTULocationManager 定位的一些方法
1 2 gitub 下载 INTULocationManager 3 4 #import "INTULocationManager.h" 5 6 INTULocationManager *locMgr = [INTULocationManager sharedInstance]; 7 // (功能一获取当前位置 ) 8 [locMgr requestLocationWithDesiredAccuracy:INTULocationAccuracyRoom timeout:10.0 block:^(CLLocation *currentLocation, INTULocationAccuracy achievedAccuracy, INTULocationStatus status) { 9 10 NSLog(@"%f %f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude); 11 12 }]; 13 14 //执行下面注释的代码,将取消执行上面的代码块内容 (won't execute the block) 15 // [[INTULocationManager sharedInstance] cancelLocationRequest:requestID]; 16 17 18 19 // (功能2申请持续获取位置 ) 20 [locMgr subscribeToLocationUpdatesWithBlock:^(CLLocation *currentLocation, INTULocationAccuracy achievedAccuracy, INTULocationStatus status) { 21 22 NSLog(@"%f %f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude); 23 24 }]; 25 26 //(功能3 位置订阅) 27 [locMgr subscribeToLocationUpdatesWithDesiredAccuracy:INTULocationAccuracyHouse 28 block:^(CLLocation *currentLocation, INTULocationAccuracy achievedAccuracy, INTULocationStatus status) { 29 if (status == INTULocationStatusSuccess) { 30 NSLog(@"weizhi"); 31 } 32 else { 33 34 } 35 }];