userLoginWithUsername won't compile in xcode #51

Closed
Yiphi opened this Issue Aug 19, 2012 · 2 comments

Projects

None yet

2 participants

@Yiphi
Yiphi commented Aug 19, 2012

Hello--I realize that I'm likely asking a newbie question. Hopefully, you guys will remember what it was like to start out and provide some guidance. As a bit of background, I've built my Drupal 6 site and am now trying to build an iOS app so that users can login and see their info using the views I've created. I've built my app framework and am now working on the ability to login from within the app. I am using Xcode (obviously), Drupal-iOS-SDK, and AFNetworking. I have added the following code to my ViewController.m file:

  • (IBAction)login:(id)sender {
    DIOSUser *user = [[DIOSUser alloc] init];
    [user userLoginWithUsername:@"userName" andPassword:@"password"]; //this line won't compile
    }

Unfortunately, the line commented above won't compile--I keep getting the error message, "No visible @interface for DIOSUser declares the selector 'userLoginWithUsername:andPassword:'. I have imported "DIOSUser.h" and the line above the problematic line compiles just fine. Additionally, I have checked DIOSUser.h and DIOSUser.m to make sure the 'userLoginWithUsername..." method is declared.

DIOSUser.h:

  • (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
    success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
    failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;

DIOSUser.m:

  • (void)userLogin:(NSDictionary *)user
    success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
    failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
    [self userLoginWithUsername:[user objectForKey:@"name"] andPassword:[user objectForKey:@"pass"] success:success failure:failure];
    }

Again, I realize that this might be an elementary question but everybody has to start somewhere. I thank you in advance for your help. Take care and have a great day!

Sincerely,

DoctorDrupal

@kylebrowning
Collaborator

The problem you are having is that these are class public methods.

You dont instatiate objects anymore.

This answer should help you, http://stackoverflow.com/questions/1053592/objective-c-class-vs-instance-methods

@Yiphi
Yiphi commented Sep 4, 2012

Thanks, Kyle.

I was able to get this issue resolved by using class public methods
properly--and the link you provided definitely helped! I apologize for
bothering you with such an elementary question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment