2014-04-25 3 views
0

iOS에서 GPS 용 라이브러리를 XCODE를 사용하여 빌드하려고하는데 라이브러리로 작동하지 않습니다. 클라이언트 응용 프로그램에서 사용할 때 didUpdateToLocation이 호출되지 않지만 제대로 작동합니다. 응용 프로그램. 나는 내가 실수 한 곳을 얻지 못하고있다.didUpdateToLocation이 iOS GPS 라이브러리에서 호출되지 않았습니다.

내가 라이브러리 코드 아래

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    LocLibrary *mFunctions = [[LocLibrary alloc] init];//Creating a object 
    [mFunctions startGps];// Calling library method 
} 

가져온 내 응용 프로그램 측 코드는 didUpdateLocation 방법은

을 LocLibarry.m 코드가 작동하지 않는 내 LocLibrary.h 아래

@interface LocLibrary : NSObject <CLLocationManagerDelegate> 
{ 
CLLocationManager *locMgr; 
int latitude,longitude; 
} 

-(void)startGps; 

@property (strong, nonatomic) CLLocationManager *locMgr; 
@property (strong, nonatomic) CLLocation *currentLocation; 
@end 

인이됩니다

-(void)startGps 
    { 
    NSLog(@"getGps"); 
    locMgr = [[CLLocationManager alloc] init]; 
    NSLog(@"getGps1"); 
    locMgr.delegate = self; 
    locMgr.distanceFilter=kCLDistanceFilterNone; 
    locMgr.desiredAccuracy = kCLLocationAccuracyBest; 
    [locMgr startUpdatingLocation];//Upto this working, it is not calling below code 
    } 

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //This method not working 
    self.currentLocation = newLocation; 
    NSLog(@"Success"); 
    if(newLocation.horizontalAccuracy <= 100.0f) 
    { 
     [locMgr stopUpdatingLocation]; 
     NSLog(@"Stopped"); 
    } 
    } 

답변

0

아래와 같은 라인을 viewDidLoad 방법으로 확인하십시오 개체를 LocLibrary2 먹고 LocLibrary에 지정합니다.

LocLibrary *mFunctions = [[LocLibrary2 alloc] init];//Creating a object 
+0

죄송합니다. LocLibrary 만 죄송합니다. 여기에 붙여 넣으 셨습니다. –

관련 문제