0

I have a question I work for an ipad application, in this app on main view I have an instance of a custom uitableviewcontroller, on row click I post a notification that pass an object and run a method

- (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]];
}

while I set the load request on the webview of my class all work, If I creat a subclass of uiwebview with a method setWebView: whit a simple NSLog()

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

I get this error:

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

Seth Flowers
  • 8,990
  • 2
  • 29
  • 42
francesco.venica
  • 1,703
  • 2
  • 19
  • 54
  • What's the relationship between `drawWebView:` and `setWebView:`? (I would also change `drawWebView:(id) sender` to `drawWebView:(NSNotification *) notification` so that you catch type errors at compile time.) – Phillip Mills Nov 15 '12 at 21:33
  • no reletion, drawWebView is on main view, this method run when mainview recive notification from uitableviewcontroller, setView is a method of uiwebview subclass. – francesco.venica Nov 15 '12 at 21:43

2 Answers2

0

Either the wrong thing is being passed as a parameter or else you have a memory management problem. You need to find out how a string is being asked for its userInfo.

If you change the parameter declaration and turn on zombies in your scheme, it should become clear which is happening.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
0

the problem was that I init the wrong class (I have two similar class) - stupid error -.- excuse me!

francesco.venica
  • 1,703
  • 2
  • 19
  • 54