我一直在尝试向我的应用程序添加一个功能来获取位置并将变量放入 mysql 数据库中。我添加了 CoreLocation.framework 并<CoreLocation/CoreLocation.h>
在标题中导入。我尝试了不同的代码,但我总是会遇到类似的错误,例如下面评论的错误。框架是否可能没有正确链接?
- (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