Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c UIWebView崩溃应用程序_Objective C_Ios_Xcode4_Io - Fatal编程技术网

Objective c UIWebView崩溃应用程序

Objective c UIWebView崩溃应用程序,objective-c,ios,xcode4,io,Objective C,Ios,Xcode4,Io,这是我的代码,所有这些代码一起使我的应用程序崩溃 分配webview值的位:在最后一行之前,它工作正常。当它发出信号时 [cell setLabelText:[cellTitle objectAtIndex:indexPath.row]]; [cell imagesetter:[imageTitle objectAtIndex:indexPath.row]]; [cell desSetter:[desTitle objectAtIndex:indexPath.row]]; [cell cha

这是我的代码,所有这些代码一起使我的应用程序崩溃

分配webview值的位:在最后一行之前,它工作正常。当它发出信号时

[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];

}

这是程序崩溃的唯一一点。当我删除它时,它不会崩溃。

您可能需要在某个时候调用[webView retain]。如果你的webView没有被你的类控制住,你会得到一个这样的SIGABART

一个简单的解决方案是在.h文件中使用:

@property (nonatomic,retain) UIWebView *webView;
然后在.m文件中执行以下操作:

@synthesize webView;
然后,无论您在何处引用您的webview,请确保添加“self”

 [self.webView loadRequest:requestObj];