Ios4 找不到CLLocationManager startUpdatingLocation

Ios4 找不到CLLocationManager startUpdatingLocation,ios4,core-location,cllocationmanager,Ios4,Core Location,Cllocationmanager,我一直在尝试向我的应用程序添加一个功能,以获取位置并将变量放入mysql数据库。我已经添加了CoreLocation.framework并在标题中导入了。我尝试过不同的代码,但总是出现类似的错误,如下面评论的错误。是否有可能框架没有正确链接 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions

我一直在尝试向我的应用程序添加一个功能,以获取位置并将变量放入mysql数据库。我已经添加了CoreLocation.framework并在标题中导入了
。我尝试过不同的代码,但总是出现类似的错误,如下面评论的错误。是否有可能框架没有正确链接

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:   (NSDictionary *)launchOptions                              
{ 
 CLLocationManager = self; // Expected identifier or '('
 [self startUpdatingLocation:nil]; // instance method '-startUpdatingLocation' not found
}



-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
 CLLocationManager *locationManager = [[CLLocationManager alloc] release];
//initializing 'CLLocationManager *' with an expression of incompatible type 'void'
[locationManager startUpdatingLocation:nil];
//do stuff with the coordinates
}



@end

请查找您的代码的更正。它应该会起作用。之后,代码应该实现CLLocationManagerDelegate方法来获取位置信息

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:   (NSDictionary *)launchOptions                              
{ 
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
 locationManager.delegate = self;
[locationManager startUpdatingLocation:nil];}



-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{

 CLLocationManager *locationManager = [[CLLocationManager alloc] init];
 locationManager.delegate = self;
[locationManager startUpdatingLocation:nil];

//do stuff with the coordinates
}