1

Two tableviews is showing in viewcontroller but when I select cell from second tableview app crashes. Please help me. Here is my delegate method

- (void)tableView:(UITableView *)atableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (atableView == self.tableView) {
NSLog(@"selected %@ row", [[[marrXMLData objectAtIndex:indexPath.row] valueForKey:@"url"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]);
NSString *link = [[[marrXMLData objectAtIndex:indexPath.row] valueForKey:@"url"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"link%@",link);
stringNotifyLink = [NSString stringWithString:link];
if (stringNotifyLink!=NULL) {
    NSString *fullURL = [NSString stringWithFormat:@"http://myweb.co.in/portal/%@",stringNotifyLink];
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [self.WebViewHome loadRequest:requestObj];
    tableView.alpha = 0;
    [tableView reloadData];
} else {
    tableView.alpha = 1;
    [tableView reloadData];
}

}else{

    NSLog(@"ssssssssss");
    dispatch_async(dispatch_get_main_queue(), ^{
    [self viewDidLoad];
    });

}}
5
  • 1
    You should not call viewDidLoad, it is supposed to be called by the system
    – valfer
    Apr 8, 2016 at 12:43
  • @valfer okay.But anyway its not entering the else block.not even nslog is showing.what should I do? Apr 8, 2016 at 12:53
  • error showing is Thread 1: EXC_BAD_ACCESS (code=1,address=0x3f80000c) and the class AppDelegate definition line is highlighted. Apr 8, 2016 at 13:59
  • I run your code without problems (after removing viewDidLoad). How did you set the delegate/datasource of your two tables? Can you provide a complete code example showing the bug?
    – valfer
    Apr 10, 2016 at 10:19
  • @valfer I use storyboard for adding delegate/datasource for both tables. But the problem is that in debug area its not showing an error,but anyway my app is crashing. I searched everywhere couldnt find the any good solution.Right now I am using one spinner view and one tableview. Apr 18, 2016 at 11:52

1 Answer 1

0

Try to set an exception breakpoint in XCode to stop the app at the crash line (see figure)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.