Sunday 15 June 2014

objective c - NSString isEqualToString won't return true, and unrecognized selector -


I have a string dummyString that should be compared to 100. This is my code

  dmestressing = [prefix objectfore: @ "display size"]; [Self set disassembly: dummy string]; NSLog (@ "Display Controller is Preparing to Set With Values% @", Dummy Strasting); NSLog (@ "1 tried"); If ([Dmestressing excel: @ "5"]) {NSLog (@ "Loaded Preferences, Short Display"); DisplayChanged.selectedSegment = 0;} NSLog (@ "Tride 2"); If ([Dmestressing Excel: @ "40"]) {NSLOG (@ "Loaded Preferences, Display Made!"); DisplayChanged.selectedSegment = 1;} NSLog (@ "Tride 3"); If ([Dmestressing avest toastring: @ "100"]) {NSLog (@ "Loaded Preferences, Display Large"); DisplayChanged.selectedSegment = 2;} NSLog (@ "display% controller is trying to meet with value% @", dummy strasting); CopyBot [1011: 303] is being prepared to set display controller with value controller 100   

  2013-03-26 17: 22 : 49.101 -03-26 17: 22: 49.102 Trying to copyboat [1011: 303] 1 2013-03-26 17: 22: 49.102 Copyboat tried [1011: 303] 2 2013-03-26 17: 22: 49.102 tried copyboat [1011: 303] 3 2013-03-26 17: 22: 49.103 copyboat [1011: 303] - [__ NSCFNumber is extolstration]: Unexpected selector sent for example 0x64c7 2013-03-26 17 : 22: 49.103 copybott [1011: 303] - [__NFFNumber avestoString:]: A For example, 0x64c7 sent to the familiar selector   

I have tried some variations to declare different stars, but it can never look like to enter an 'if' statement. Is any comparison for any comparison, is Aval or EqualToString any help is appreciated.

According to your error your dummyString is not NSSTING In fact it is NSNumber .

You compare your string with @ "5" to NSNumber and then compare:

  BOOL equals = [dmestressing Excel Number: @ ([@ "5" Integer Value]];   

or convert the dammestring value to a string and then compare:

  BOOL equal = [NSString stringWithFormat: @ "% d", [dummyString IntegerValue]] is EqualToString: @ "5"];    

No comments:

Post a Comment