Python Badoo repeat-如何确定和跟踪用户';IOS中的位置?

Python Badoo repeat-如何确定和跟踪用户';IOS中的位置?,python,ios,objective-c,django,cocoa-touch,Python,Ios,Objective C,Django,Cocoa Touch,我想做以下几件事 使用核心位置不断更新用户的位置,并将该信息发送到数据库 我正在创建一个像badoo这样的应用程序,所以我需要随时知道用户的位置,以便知道他们附近的人 我做了以下工作: 我将以下代码放入ApplicationIDFinishLaunchWithOptions locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; [locationManager startUpd

我想做以下几件事

  • 使用核心位置不断更新用户的位置,并将该信息发送到数据库
我正在创建一个像badoo这样的应用程序,所以我需要随时知道用户的位置,以便知道他们附近的人

我做了以下工作:

我将以下代码放入
ApplicationIDFinishLaunchWithOptions

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
然后在
AppDelegate.m

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
    self.currentLocation = newLocation;

    // send location to server

    if(newLocation.horizontalAccuracy <= 100.0f) { [locationManager stopUpdatingLocation]; }
}
-(void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation{
self.currentLocation=新位置;
//将位置发送到服务器

如果(newLocation.horizontalAccuracy至于效率-这取决于你的意思。你描述的方法不允许用户实际启动确定位置的过程-它在应用程序启动时启动。如果这是你的意图,那么我认为这对于用户来说是有效的,用户不需要花时间启动它

但是,您在appdelegate文件中有代码。为了提高维护代码的效率,我不同意您提供的模式。为了提高效率(在开发方面),最好让一个单独的模型处理来自location manager的更新,并让appdelegate创建所述模型的实例


抱歉-无法帮助django。

您所说的单独型号是什么意思