2016-04-08 10 views
0
`I am develop `IOS` App. Store data on Nsmutablearray using class object.and show the data on tableview and pass the data on next viewcontroller.On next viewcontroller get value for using class object app crash error msg is reason`: '-[ReligiousStatus objectAtIndex:]: unrecognized selector sent to instance 0x7b9f0100' 

をクリックしても、TextViewの文字列value.the同じエラーを変更]ボタンをクリックしパスアレイ値とボタンのテキストを変更

を表示します内の任意の助けと感謝を教えてください

//Code 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    ViewStatusViewController *view = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"viewStatus"]; 

    view.array = [self.Data objectAtIndex:indexPath.row]; //pass data to another view controller 

    [self.navigationController pushViewController:view animated:YES]; 
} 

//get value from second viewcontroller 
ReligiousStatus *sts = [_array objectAtIndex:0]; //Class name ReligiousStatus 
    _textView.text = sts.status; 

//button click change the textView value 

- (IBAction)next:(id)sender { 
    NSInteger increment; 
    increment++; 

// NSMutableArray *arr = [NSMutableArray arrayWithObject:_status.status]; 

    ReligiousStatus *sts = (ReligiousStatus *)[_array objectAtIndex:increment]; 
     _textView.text = [NSString stringWithFormat:@"%@",sts.status]; 

    if (increment> sts.status.length) { 


     _textView.text = [NSString stringWithFormat:@"%@",sts.status]; 
    } 

答えて

0

を進める

[self.Data objectAtIndex:indexPath.row]; 

が配列され、オブジェクトが含まれていることを確認してください使用前に

それはオブジェクト

if(array.count) { 

} 
が含まれている場合、それはチェック
関連する問題