我在Gimbal框架中遇到了这个问题:当我尝试用选项启动FYXVisitManager时,系统不会调用delgate方法:我用以下几行代码初始化对象:
self.visitManager = [[FYXVisitManager alloc] init];
self.visitManager.delegate = self;
NSMutableDictionary *options = [NSMutableDictionary new];
[options setObject:[NSNumber numberWithInt:-40] forKey:FYXVisitOptionArrivalRSSIKey];
[options setObject:[NSNumber numberWithInt:-75] forKey:FYXVisitOptionDepartureRSSIKey];
[self.visitManager startWithOptions:options];
为了正常工作,您必须:-
- 将FYXServiceDelegate和FYXVisitDelegate协议实现到类并设置委托
[FYX disableLocationUpdates]; [FYX setAppId:@"your_app_id" appSecret:@"your_app_secret" callbackUrl:@"your_callback_url"]; [FYX startService:self];
- 现在将代码放入方法
-(void)serviceStarted{}
中,并将此代码添加到代码NSMutableDictionary *options = [[NSMutableDictionary alloc] init]; [options setObject:[NSString stringWithString:FYXHighAccuracyLocation] forKey:FYXLocationModeKey]; [FYX enableLocationUpdatesWithOptions:options];
之前附言:如果你想使用后台处理,这必须在appdelegate中完成