我是新的万向框架,我试图在基本层面使用这个框架。下面是我的代码:
- (void)viewDidLoad
{
....
self.contextCoreConnector = [[QLContextCoreConnector alloc] init];
self.contextCoreConnector.permissionsDelegate = self;
self.contextPlaceConnector = [[QLContextPlaceConnector alloc] init];
self.contextPlaceConnector.delegate = self;
self.contextInterestsConnector = [[PRContextInterestsConnector alloc] init];
self.contextInterestsConnector.delegate = self;
self.contentConnector = [[QLContentConnector alloc] init];
self.contentConnector.delegate = self;
[self.contextCoreConnector checkStatusAndOnEnabled:^(QLContextConnectorPermissions *contextConnectorPermissions) {
if (contextConnectorPermissions.subscriptionPermission)
{
if (self.contextPlaceConnector.isPlacesEnabled)
{
[self displayLastKnownPlaceEvent];
}
}
}
disabled:^(NSError *error) {
NSLog(@"%@", error);
if (error.code == QLContextCoreNonCompatibleOSVersion)
{
NSLog(@"%@", @"SDK Requires iOS 5.0 or higher");
}
else
{
enableSDKButton.enabled = YES;
placeNameLabel.text = nil;
contentInfoLabel.text = nil;
}
}];
}
#pragma mark - QLContextPlaceConnectorDelegate methods
- (void)didGetPlaceEvent:(QLPlaceEvent *)placeEvent
{
NSLog(@"Got place event");
[self savePlaceEvent:placeEvent];
[self displayLastKnownPlaceEvent];
}
- (void)didGetContentDescriptors:(NSArray *)contentDescriptors
{
contentInfoLabel.text = [[contentDescriptors lastObject] title];
NSLog(@"didGetContentDescriptors : %@",contentInfoLabel.text);
[self displaceLastKnownContentDescriptor];
for (QLContentDescriptor *contentDescriptor in contentDescriptors)
{
[self postOneContentDescriptorLocalNotification:contentDescriptor];
}
}
但是方法
- (void)didGetContentDescriptors:(NSArray *)contentDescriptors
没有被调用。我不知道为什么会这样。在SDK提供的演示应用程序中,此方法被调用,但不在我的应用程序中。我已经匹配了两个应用程序的代码,但我无法在我的应用程序中找到问题。
如果有人能帮忙,我将非常感激。
是否正在调用didGetPlaceEvent委托方法?