2011-09-02 31 views
0

這是我的代碼,一起崩潰我的應用程序UIWebView的應用程式當

來分配的WebView它的價值位:它正常工作,直到最後一行。當它SIGBARTS。

[cell setLabelText:[cellTitle objectAtIndex:indexPath.row]]; 
[cell imagesetter:[imageTitle objectAtIndex:indexPath.row]]; 
[cell desSetter:[desTitle objectAtIndex:indexPath.row]]; 


[cell changeProductWeb:[webTitle objectAtIndex:indexPath.row]]; 

的陣列

webTitle = [[NSArray alloc] initWithObjects: 

      @"http://www.google.com/", 
      @"http://www.google.com/", 
      @"http://www.google.com/", 
      @"http://www.google.com/", 

      nil]; 

動作

- (IBAction) changeProductWeb:(NSString *)str{ 

    NSURL *url = [NSURL URLWithString:str]; 
    NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:url];   
    [webView loadRequest:requestObj]; 

} 

這是唯一的位崩潰該程序。當我刪除它不會崩潰。

+0

webview如何創建? – Nekto

回答

0

您可能需要在某個時候調用[webView retain]。如果你的webView沒有被你的課程所吸引,你會得到這樣的SIGABART。

一個簡單的解決方法是在你的.h文件中使用此:

@property (nonatomic,retain) UIWebView *webView; 

然後在您.m文件去:

@synthesize webView; 

然後,無論你是指你的WebView,確保添加「自我」

[self.webView loadRequest:requestObj];