views:

239

answers:

1

Hi guys,

I have a UIViewController (which sits inside a tabUIController). Within this UIViewController, I want to present a modelviewcontroller when a user clicks on a button. I cannot get this to work. With the code I have (see below) i get to the stage where i press the button but i get the strange error of "unable to read unknown load command 0x80000022".

Any ideas? (for the BrowserUIViewController i havent added anything in there yet, but it shouldnt matter, with any controller i just want to get the syntax right).

@interface AboutDoronUIViewController : UIViewController 
   <UITableViewDelegate, UITableViewDataSource> {

NSDictionary *values;
NSArray   *keys;
BrowserUIViewController *browser;
AboutDoronUIViewController *about;

}

@property (retain, nonatomic) NSDictionary *values;
@property (retain, nonatomic) NSArray *keys;
@property (retain, nonatomic) BrowserUIViewController *browser;
@property (retain, nonatomic) AboutDoronUIViewController *about;
@end


...
- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSInteger section = [indexPath section];
    NSUInteger row = [indexPath row];

    NSString *getSection = [keys objectAtIndex:section];     
    NSArray *valuesForSection = [values objectForKey: getSection];

    NSString *selectedLink = [valuesForSection objectAtIndex:row];

    NSString *urlAddress = @"http://www.google.com";

    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];

    //URL Requst Object
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //unused for now

    BrowserUIViewController *temp = [[BrowserUIViewController alloc] initWithNibName:@"BrowserUIViewController" bundle:nil];

    self.browser = temp;

    [self presentModalViewController:browser animated:YES];

    [urlAddress release];
    [valuesForSection release];
    [selectedLink release];
    [getSection release];
    [temp release];
}
A: 

The code you have here looks correct, so your issue is likely elsewhere.

Try to put breakpoints around the presentModalViewController:animated: line to see what lines get executed before the error occurs.

Try putting breakpoints in the viewDidLoad and viewWillAppear: methods of the BrowserUIViewController class as well, to see which of those, if any, are being called before the error occurs.

Ed Marty
So you think its a IB issue? Can you guide me through what would be the requirements in terms of connecting the supposed modal controller.. Of note, I have noticed in the controller calling this modal controller, there is no window, it seems to access view directly, so is this fine?
Doron Katz