我已经下载这个Raywenderlich tutorial,我遇到了这部分代码的问题。ARC语义问题,语义问题错误。
我还是iOS开发新手,我不明白这是什么意思。我通过互联网搜索,但没有一个是答案。
请帮我解决这个问题。
int index = [_locations indexOfObjectPassingTest:^(id obj, NSUInteger index, BOOL *stop) {
return [[obj location] isEqual:location];
}];
有3个误差如下:命名为“位置”
多种方法与失配的结果是,参数类型中找到或属性
不相容的嵌段指针类型发送“无效(^) (__strong ID,NSUInteger,BOOL *)”到类型的参数 'BOOL(^)(__强ID,NSUInteger,BOOL *)'
为接收器类型 'CGFloat的'(亦称 '浮动')
下面是完整的代码,在那里你可以找到这一行:
- (void)didTouchMarkerView:(MarkerView *)markerView
{
ARGeoCoordinate *tappedCoordinate = [markerView coordinate];
CLLocation *location = [tappedCoordinate geoLocation];
int index = [_locations indexOfObjectPassingTest:^(id obj, NSUInteger index, BOOL *stop) {
return [[obj location] isEqual:location];
}];
if(index != NSNotFound)
{
Place *tappedPlace = [_locations objectAtIndex:index];
[[PlacesLoader sharedInstance] loadDetailInformation:tappedPlace successHanlder:^(NSDictionary *response) {
NSLog(@"Response: %@", response);
NSDictionary *resultDict = [response objectForKey:@"result"];
[tappedPlace setPhoneNumber:[resultDict objectForKey:kPhoneKey]];
[tappedPlace setWebsite:[resultDict objectForKey:kWebsiteKey]];
[self showInfoViewForPlace:tappedPlace];
} errorHandler:^(NSError *error) {
NSLog(@"Error: %@", error);}];
}
}
有同样的问题。这个答案应该被标记为这个特定问题的接受答案。 –