Error "isEqualToString" Cocoa

I get an error in my console:

2009-05-30 20: 17: 05.801 ChuckFacts [1029: 20b] *** - [Joke isEqualToString:]: unrecognized selector sent to instance 0x52e2f0

Here is my code, which I believe comes from:

- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Joke";  
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) { 
    [[NSBundle mainBundle] loadNibNamed:@"TableCell" owner:self options:nil]; 
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero 
                                   reuseIdentifier:CellIdentifier] autorelease];
    cell = tableCell;
}

NSString *jokeText = [jokes objectAtIndex:indexPath.row];
UILabel *jokeTextLabel = (UILabel*) [cell viewWithTag:1];
jokeTextLabel.text = jokeText; 
NSString *dateText = formattedDateString;
UILabel *dateTextLabel = (UILabel*) [cell viewWithTag:2];
dateTextLabel.text = dateText;
[self todaysDate];
return cell;
}

"jokes" is an array full of jokes if you need to know

Why does this error occur?

You also see the part of the error that says:

sent to instance 0x52e2f0

How can I determine what "0x52e2f0" is, so it would be easier to find the problem next time?

+3
source share
2 answers

Why does this error occur?

isEqualToString: Joke, Joke isEqualToString:.

, Joke; Joke -, NSString.

, jokes " ". , :

NSString *jokeText = [jokes objectAtIndex:indexPath.row];
UILabel *jokeTextLabel = (UILabel*) [cell viewWithTag:1];
jokeTextLabel.text = jokeText;

, , ", ", " Joke".

Joke NSString * Joke NSString. , , , NSString, . " ".

:

Joke *joke = [jokes objectAtIndex:indexPath.row];

, , :

jokeTextLabel.text = jokeText; 

: 1 'setText: Objective-C

, . NSStrings. , , .

, Joke ( , , NSString) jokeTextLabel.text.

, "0x52e2f0", ?

Xcode Breakpoints objc_exception_throw. . , , Debugger. po 0x52e2f0 . (po " ".)

Mac; , iPhone-.

+18

", ", , -, ", " ". Joke UILabel text - NSString.

(Cocoa Java ++, .toString(). NSString , .)

: Joke text. Cocoa , , NSString ( id , ). isEqualToString: ( NSString) Joke, , .

.

: po 0x52e2f0 , , . Objective-C .

+2

Source: https://habr.com/ru/post/1709454/


All Articles