I'm trying to extract a string (which contains an integer) from an array and then use it as an int in a function. I'm trying to convert it to a int using intValue.
Here's the code I've been trying.
NSArray *_returnedArguments = [serverOutput componentsSeparatedByString:@":"];
[_appDelegate loggedIn:usernameField.text:passwordField.text:(int)[[_returnedArguments objectAtIndex:2] intValue]];
I get this error:
passing argument 3 of 'loggedIn:::' makes pointer from integer without a cast
What's wrong?
(int)partloggedIn:::method, which is a decidedly un-Objective-C way to do things.loggedIn:::. The rest of that declaration is just parameter names, not part of the selector. Idiomatically, it should be- (void)loggedIn:(NSString *)tusername password:(NSString *)tpassword userID:(int)userId. And then you would call it as[_appDelegate userIsLoggedIn:usernameField.text password:passwordField.text userID:[[_returnedArguments objectAtIndex:2] intValue]];.