views:

358

answers:

6

Hi there,

Compiling my application works—everything is fine. The only errors I get are by deprecated functions (setText).

The only problem is now, is that when I tap on a cell in my table, the app crashes, even though it's meant to push to the next view in the stack.

Any solutions are appreciated, if you need any code, just ask.

Also, how can I only make sure that one cell goes to only one view? For example:

When I tap on CSS, it takes me to a new table with different levels of CSS. WHen I tap on an item in that new view, it comes up with an article on what I just selected.

Regards,
Jack

Here's my code at the didSelectRowAtIndexPath method:

   -(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if(indexPath.row==0){

    NextViewController *nextController = [[NextViewController alloc]
                                          initWithNibName:@"NextView" bundle:nil];
    [self.navigationController pushViewController:nextController
                                         animated:YES];
    [nextController changeItemTable:[arryClientSide
                                     objectAtIndex:indexPath.row]];
}
}
@end

(as requested in the comments).

A: 

Hi, Jack

you need to update your code like this :

 -(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if(indexPath.row==0){

    NextViewController *nextController = [[NextViewController alloc]
                                          initWithNibName:@"NextView" bundle:nil];
    [nextController changeItemTable:[arryClientSide
                                     objectAtIndex:indexPath.row]];
    [self.navigationController pushViewController:nextController
                                         animated:YES];
    }
else{   }
}

try using this code...

yakub_moriss
Is your change the 'else' clause?
JBRWilkinson
With that changed, the app still quits when you tap a cell.
Jack Griffiths
hi, Jack try using this code...
yakub_moriss
A: 

Error description from comments:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "NextView" nib but the view outlet was not set.'

If your view controller is loaded from nib file and its view is not set exception then exception is thrown. So when you create your view in IB you must connect view outlet to your view controller object (likely - file owner in IB).

Edit: So basically in IB in your nib file you need to do the following:
1. set file owner's type to NextViewController
2. connect NextViewController's view outlet to a View object

Vladimir
Not so sure as to what you mean. Could you direct me to where and what I'm meant to amend in my nib file? Cheers.
Jack Griffiths
+1  A: 

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: -[UIViewController _loadViewFromNibNamed:bundle:] loaded the "NextView" nib but the view outlet was not set.'

  1. Open NextView with Interface Builder
  2. Set Class value at : "NextViewController" to your File's Owner set files owner class
  3. Connect the View outlet (Ctrl click and drag - a blue line should appear - from the File Owner to the UIView and select "view" in options) alt text
F.Santoni
Thank you. Now, I have another error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "NextView" nib but didn't get a UITableView.' I'm assuming that's something else to do with an interface builder mismatch.
Jack Griffiths
Look at the doc : http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewController_Class/Reference/Reference.html ---- UITableViewController must have it's tableView property set
F.Santoni
Could you explain a bit more? I'm pretty much new to App Development, plus I'm only 14 so my use of technical jargon may be hasty in places, and I barely have much time. I try and get things in when I can.
Jack Griffiths
A: 

Hi, I am getting an error trying to do the same thing as the original poster. My problem is when trying to load a detail view, the application constantly crashes. The error that comes up when running through debug is "__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION objc exception thrown. If anyone can help me it would be greatly appreciated.

Here is a screenshot for the debug, I am not sure if I am interpreting it right http://img43.imageshack.us/img43/2143/errorud.png

Here is my code where I beleive the error is happening:

- (void)tableView:(UITableView *)tableView  didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
if(self.moreDetailView == nil){
    DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
    self.moreDetailView = dvController;
    [dvController release];
}
else{}
moreDetailView.title = [NSString stringWithFormat:@"%@", [listOfItems objectAtIndex:row]];

goHerdv2AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.detailView pushViewController:moreDetailView animated:YES];
Jeb Sears
A: 

release that NextViewController you alloc!

[nextController release];

It's leaking.

Rigo Vides
A: 

@Rigo Vides

should release nextController after pushViewController

owen