2013-02-11 101 views
0

正如你可以在標題中看到的,我有一個小問題。我正在使用MWParser作爲RSS提要。當我點擊RSS標題時,我編輯了代碼,它會在應用內瀏覽器中打開。 這是代碼:試圖從TableView傳遞給UIWebview導致崩潰

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    if (_webViewController == nil) { 
     self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease]; 
    } 

    MWFeedItem *entry = [parsedItems objectAtIndex:indexPath.row]; 
    _webViewController.entry = entry; 
    [self.navigationController pushViewController:_webViewController animated:YES]; 


    // Deselect 
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 

} 

不過,我得到這個消息崩潰:

2013-02-11 18:21:15.644 GlennKessler[24209:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/Hugo/Library/Application Support/iPhone Simulator/6.1/Applications/7F35D6C0-BFBE-4CD9-A1CE-7DC54CD6B249/GlennKessler.app> (loaded)' with name 'WebViewController'' 

從我可以告訴,這種情況正在發生,因爲我使用的故事板,而不是發鈔銀行。我如何讓它在故事板中打開WebViewController中代碼運行的視圖?謝謝!

回答

0

由零替換[一個NSBundle mainBundle]由於筆尖是在默認捆綁,並確保筆尖文件(WebViewController.nib)是包要打包的應用程序

+0

但是我用的是故事板。不是NIB。不知道如何解決它。 – user1941966 2013-02-11 23:37:04

+0

其實,我只是使用了NIB,它工作。 – user1941966 2013-02-11 23:42:36

+0

那麼,你正在使用Nib文件加載ViewController,這就是爲什麼它試圖在包中查找文件。 – HyLian 2013-02-11 23:45:29