Xcode를 버전 6으로 업데이트하고 이전 iOS 애플리케이션의 배포 대상을 이전 7.0에서 8.1로 변경했습니다. 이 업데이트가 있기 전에는 응용 프로그램이 iPad 및 iOS 시뮬레이터에서 문제없이 실행되었습니다.시뮬레이터 8에서는 앱이 작동하지 않지만 기기에서는 작동하지 않습니다.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell disclosureButton]: unrecognized selector sent to instance 0x7f85c7f0'
BuildingCell 또는 특별한 어디에도 없습니다 : 업데이트 그러나 후, 나는 내 장치에서 이전과 응용 프로그램을 실행할 수 있습니다 (이전에 아이폰 OS 7뿐만 아니라 단지 아이폰 OS 8.1으로 업데이트) 그러나 그것은 NSInvalidArgumentException와 시뮬레이터에 충돌 그 문제에 대해서는 disclosureButton. 그러나 공개 버튼에 작업을 추가하려고하면 앱이 다운됩니다.
BuildingCell 헤더 :
@interface BuildingsCell : UITableViewCell
@property (strong, nonatomic) UIButton *disclosureButton;
@end
기능 응용 프로그램이 충돌 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"BuildingCell";
BuildingsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [BuildingsCell.alloc initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.accessoryType = UITableViewCellAccessoryNone;
//*** App crashes on the line below ***
[cell.disclosureButton addTarget:self action:@selector(tappedCell:)forControlEvents:UIControlEventTouchUpInside];
Building *currentBuilding = self.buildingArray[indexPath.row];
return cell;
}
기능 내가 disclosureButton에 연결을 시도
- (void) tappedCell:(id)sender
{
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.buildingTableView];
NSIndexPath *indexPath = [self.buildingTableView indexPathForRowAtPoint:buttonPosition];
[self tableView:self.buildingTableView accessoryButtonTappedForRowWithIndexPath:indexPath];
}
내가 잘못 아무것도 찾을 수 없습니다 코드와 함께. 시뮬레이터에 문제가있을 수 있습니까? 시뮬레이터에 설정해야하는 매개 변수가 있습니까? Xcode 나이 응용 프로그램을 많이 사용하지는 않았지만 분명히 뭔가 빠졌습니다. 제가 생각을 어 기고 나서 어떤 제안이라도 도움이 될 것입니다.
'accessoryType'에 대해 'UITableViewCellAccessoryDetailDisclosureButton'이 필요합니다. 아마도 나는 틀렸거나 뭔가 빠졌을 것입니다. – lewiguez
나는 방금 lewiguez와 같은 말을하려고했습니다. 존재하지 않는 항목에 이벤트를 추가하려고합니다. 충돌 위의 줄을 cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton으로 변경해보십시오. –
또한, 분명히하기 위해 alloc/init 쌍에 cell = BuildingsCell.alloc이 있습니다. 7. 오타가 아닌지 확실하지 않습니다. 나는 아직 추측하고 있지만, 단지 그것을 지적하고 싶었다. – lewiguez