2012-11-15 64 views
0

我有一个问题,我为iPad应用程序工作,在这个应用程序的主视图上我有一个自定义的uitableviewcontroller实例,在行点击我发布通知,通过一个对象和运行方法传递字符串通知,然后传递给类

- (void) drawWebView:(id) sender { 

    NSDictionary *dict = [[sender userInfo] copy]; 
    self.objTesto = [dict objectForKey:@"Testo"]; 
    self.txtWeb = self.objTesto.testo; 

    //[self setWebView:self.txtWeb]; 
    [self.textWebView loadRequest:[self creaFileHTML:text]]; 
} 

,而我设置上我的课全部工作的web视图的负荷要求,如果我创造一个方法setWebView的UIWebView的子类:白衣简单的NSLog()

[self setWebView:self.txtWeb]; 
//[self.textWebView loadRequest:[self creaFileHTML:text]]; 

我得到这个错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString userInfo]: unrecognized selector sent to instance 0xee3a1e0'

+0

'drawWebView:'和'setWebView:'之间的关系是什么? (我也会将'drawWebView:(id)sender'改为'drawWebView:(NSNotification *)notification',以便在编译时捕获类型错误。) –

+0

无关联,drawWebView在主视图上,当mainview recive来自uitableviewcontroller的通知,setView是uiwebview子类的一个方法。 – kikko088

回答

0

问题是我启动了错误的类(我有两个类似的类) - 愚蠢的错误 - 请原谅!

0

要么将​​错误的事情作为参数传递,要么存在内存管理问题。您需要了解如何为其userInfo询问字符串。

如果你改变了参数声明并在你的方案中打开僵尸,它应该清楚发生了什么。