1
0   YunYing                             0x0003fbc1 -[EnterpriseInfo didSelectCellRowFirstDo:nextDo:] + 993
1   YunYing                             0x0003f569 -[EnterpriseInfo tableView:didSelectRowAtIndexPath:] + 473
2   UIKit                               0x00564285 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1194
3   UIKit                               0x005644ed -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201
4   Foundation                          0x00f6e5b3 __NSFireDelayedPerform + 380
5   CoreFoundation                      0x01b6f376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
6   CoreFoundation                      0x01b6ee06 __CFRunLoopDoTimer + 534
7   CoreFoundation                      0x01b56a82 __CFRunLoopRun + 1810
8   CoreFoundation                      0x01b55f44 CFRunLoopRunSpecific + 276
9   CoreFoundation                      0x01b55e1b CFRunLoopRunInMode + 123
10  GraphicsServices                    0x0208c7e3 GSEventRunModal + 88
11  GraphicsServices                    0x0208c668 GSEventRun + 104
12  UIKit                               0x004b4ffc UIApplicationMain + 1211
13  YunYing                             0x0000221d main + 141
14  YunYing                             0x00002145 start + 53
)
 2013-03-25 16:52:39.867 YunYing[4242:c07] -[__NSDictionaryM isEqualToString:]:       unrecognized selector sent to instance 0x154bd020
  2013-03-25 16:52:39.868 YunYing[4242:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM isEqualToString:]:  unrecognized selector sent to instance 0x154bd020'
  *** First throw call stack:
  (0x1bb0012 0x1570e7e 0x1c3b4bd 0x1b9fbbc 0x1b9f94e 0x60de9f 0x60e064 0x3efed 0x56f8fb   0x56f9cf 0x714f30 0x71f7e2 0x55a016 0x556617 0x562945 0x562973 0x3fc26 0x3f569 0x564285 0x5644ed 0xf6e5b3 0x1b6f376 0x1b6ee06 0x1b56a82 0x1b55f44 0x1b55e1b 0x208c7e3 0x208c668 0x4b4ffc 0x221d 0x2145)
  libc++abi.dylib: terminate called throwing an exception

-[__ NSDictionaryM isEqualToString:]:認識されないセレクターがインスタンスに送信されました

、このメソッドを呼び出すと[self.tableView endUpdates]、コードはここで停止し、ブレークポイントデバッグによってエラーをスローします。

コードを確認しましたが、NSDictionaryオブジェクト呼び出しisEqualToStringメソッドではありません。

ありがとう!以下は私のコードです:そして私は引き込み式のテーブルビューを実装したいだけです

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return arrayForShow.count;
}




-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{   
    if (self.isOpen) {
    if (self.selectIndex.section==section) {
        return [[[arrayForShow objectAtIndex:section]objectForKey:@"list"]count]+1;
    }
    }
    return 1; 
 }




-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath
{

    if ((self.isOpen)&&(self.selectIndex.section==indexPath.section)&&(indexPath.row!=0)){
    static NSString *CellIdentifier = @"EnterpriseCell";

    EnterpriseCell *cell=(EnterpriseCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell==nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"EnterpriseCell" owner:self options:nil] objectAtIndex:0];
    }
    NSArray *enterpriseNames=[[arrayForShow objectAtIndex:indexPath.section]objectForKey:@"list"];
    cell.enterpriseName.text = [enterpriseNames objectAtIndex:indexPath.row-1];
    return cell;

}
    else
    {
    static NSString *CellIdentifier = @"CityCell";
    CityCell *cell=(CityCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell==nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"CityCell" owner:self options:nil]objectAtIndex:0];
    }
    NSString *name=[[arrayForShow objectAtIndex:indexPath.section]objectForKey:@"name"];
    cell.cityName.text=name;
    [cell changeArrowWithUp:([self.selectIndex isEqual:indexPath]? YES:NO)];

        return cell;
    }  
}




-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        if ([indexPath isEqual:self.selectIndex]) {
        self.isOpen = NO;
        [self didSelectCellRowFirstDo:NO nextDo:NO];
        self.selectIndex = nil;

        }else
        {
            if (!self.selectIndex) {
            self.selectIndex = indexPath;
            [self didSelectCellRowFirstDo:YES nextDo:NO];

            }else
            {

            [self didSelectCellRowFirstDo:NO nextDo:YES];
        }
    }

}
else
{
    NSDictionary *dic = [arrayForShow objectAtIndex:indexPath.section];
    NSArray *list = [dic objectForKey:@"list"];
    NSString *item = [list objectAtIndex:indexPath.row-1];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:item message:nil delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles: nil];
    [alert show];
}

[tableView deselectRowAtIndexPath:indexPath animated:YES];

}


- (void)didSelectCellRowFirstDo:(BOOL)firstDoInsert nextDo:(BOOL)nextDoInsert
{
    self.isOpen = firstDoInsert;

    CityCell *cell = (CityCell *)[self.cityTable cellForRowAtIndexPath:self.selectIndex];
    [cell changeArrowWithUp:firstDoInsert];



   int section = self.selectIndex.section;
    int contentCount = [[[arrayForShow objectAtIndex:section] objectForKey:@"list"] count];

NSMutableArray* rowToInsert = [[NSMutableArray alloc] init];
for (NSUInteger i = 1; i < contentCount + 1; i++) {
    NSIndexPath* indexPathToInsert = [NSIndexPath indexPathForRow:i inSection:section];
    [rowToInsert addObject:indexPathToInsert];
}

[self.cityTable beginUpdates];

if (firstDoInsert)
{   [self.cityTable insertRowsAtIndexPaths:rowToInsert withRowAnimation:UITableViewRowAnimationTop];
}
else
{
    [self.cityTable deleteRowsAtIndexPaths:rowToInsert withRowAnimation:UITableViewRowAnimationTop];
}

[self.cityTable endUpdates];

    if (nextDoInsert) {
    self.isOpen = YES;
    self.selectIndex = [self.cityTable indexPathForSelectedRow];
    [self didSelectCellRowFirstDo:YES nextDo:NO];
    }
    if (self.isOpen){
    [self.cityTable scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:YES];
    }

}
4

2 に答える 2

2

コードのどこかで、呼び出しを行っていますisEqualToString。現在、ソース文字列はその時点では無効です。リリースされたか、Dictionaryオブジェクトを指している。

メソッドの呼び出しを生成している文字列変数の参照を確認してくださいisEqualToString

于 2013-03-25T08:10:55.397 に答える
0

適切なデータがないNSDictionaryMを使用しているため、このタイプのエラーが発生するか、NSDictionaryが含まれているテーブルに格納されている値を確認します。

于 2013-03-25T08:03:11.363 に答える