Note that there are some explanatory texts on larger screens.

plurals
  1. POBool method to check user input
    text
    copied!<p>Hi everybody i am trying to make a boolean method that will return value depending upon the user input for the field when submit button is clicked.</p> <pre><code> - (BOOL)checkuser:(NSString*)input { bool result = NO; if ([input isEqualToString:@"test"]) { result = YES; } else { result = NO; } return result; } </code></pre> <p>And i am refrencing this method from my program as </p> <pre><code>else if ([Username checkuser] == YES) { // do something } </code></pre> <p>with following warning 'NSString' may not respond to '-checkuser'</p> <p>and i am not getting why my program crashing at this point with following error.</p> <p>2011-03-22 22:57:25.942 Assignment 2[824:207] -[NSCFString checkuser]: unrecognized selector sent to instance 0x4b7c050 2011-03-22 22:57:25.944 Assignment 2[824:207] <strong>* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString checkuser]: unrecognized selector sent to instance 0x4b7c050' *</strong> Call stack at first throw: ( 0 CoreFoundation 0x00db8be9 <strong>exceptionPreprocess + 185 1 libobjc.A.dylib 0x00f0d5c2 objc_exception_throw + 47 2 CoreFoundation 0x00dba6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x00d2a366 __<em>forwarding</em></strong> + 966 4 CoreFoundation 0x00d29f22 _CF_forwarding_prep_0 + 50 5 Assignment 2 0x00002958 -[Assignment_2ViewController SubmitbuttonPressed:] + 727 6 UIKit 0x002c1a6e -[UIApplication sendAction:to:from:forEvent:] + 119 7 UIKit 0x003501b5 -[UIControl sendAction:to:forEvent:] + 67 8 UIKit 0x00352647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 9 UIKit 0x003511f4 -[UIControl touchesEnded:withEvent:] + 458 10 UIKit 0x002e60d1 -[UIWindow _sendTouchesForEvent:] + 567 11 UIKit 0x002c737a -[UIApplication sendEvent:] + 447 12 UIKit 0x002cc732 _UIApplicationHandleEvent + 7576 13 GraphicsServices 0x016eea36 PurpleEventCallback + 1550 14 CoreFoundation 0x00d9a064 <strong>CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION</strong> + 52 15 CoreFoundation 0x00cfa6f7 __CFRunLoopDoSource1 + 215 16 CoreFoundation 0x00cf7983 __CFRunLoopRun + 979 17 CoreFoundation 0x00cf7240 CFRunLoopRunSpecific + 208 18 CoreFoundation 0x00cf7161 CFRunLoopRunInMode + 97 19 GraphicsServices 0x016ed268 GSEventRunModal + 217 20 GraphicsServices 0x016ed32d GSEventRun + 115 21 UIKit 0x002d042e UIApplicationMain + 1160 22 Assignment 2 0x00001c04 main + 102 23 Assignment 2 0x00001b95 start + 53 ) terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”. (gdb) </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload