在集成 Gimbal FYX 信标发现后,我也尝试添加地理围栏监控。我密切关注指南并多次重写代码,最终得到相同的崩溃和错误消息:
* 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“* -[NSURL initFileURLWithPath:]: nil string parameter”
在我的代码中,我没有访问任何文件或从 initWithContentsOfFile: 方法创建任何 NSObjects!
我的代码:
[connector enableFromViewController:viewController success:^{
NSLog(@"ContextCoreConnector ACTIVATED!");
self.placeConnector = [[QLContextPlaceConnector alloc] init];
self.placeConnector.delegate = self;
[self.placeConnector monitorPlacesWhenAllowed];
[self.placeConnector monitorPlacesInBackground];
if ([self.geofenceDelegate respondsToSelector:@selector(startedGeofenceMonitoring)]) {
[self.geofenceDelegate startedGeofenceMonitoring];
}
} failure:^(NSError *error) {
NSLog(@"ContextCoreConnector FAILED!\n%@",error.localizedDescription);
if ([self.geofenceDelegate respondsToSelector:@selector(startedGeofenceMonitoring)]) {
[self.geofenceDelegate startedGeofenceMonitoring];
}
}];