|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Passing String with Notification and than pass to class
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
Code:
- (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]];
}
Code:
[self setWebView:self.txtWeb]; //[self.textWebView loadRequest:[self creaFileHTML:text]]; Code:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString userInfo]: unrecognized selector sent to instance 0xee3a1e0'
__________________
iTouch 1G |
|
|
|
0
|
|
|
#2 | |
|
Quote:
It's usually a bad idea to declare a method paramater as the "id" type, because you lose type safety. |
||
|
|
0
|
|
|
#3 |
|
the sender is an object, here I get the string:
Code:
self.objTesto = [dict objectForKey:@"Testo"]; self.txtWeb = self.objTesto.testo; I think, if I use it without an external class all work.
__________________
iTouch 1G |
|
|
|
0
|
|
|
#4 |
|
the problem was that I init the wrong class (I have two similar class) - stupid error -.- excuse me!
__________________
iTouch 1G |
|
|
|
0
|
|
|
#5 |
|
That's why you should avoid declaring variables and parameters as type "id". These sorts of errors would get picked up by the compiler, instead of causing crashes at runtime!
|
|
|
|
0
|
|
|
#6 |
|
I just wanted to say that it is pretty common for the sender parameter of an IBAction to be data-typed as an id.
__________________
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 07:48 PM.







I support the
Linear Mode
