views:

65

answers:

1

Hey guys

Just a quick question, I'm currently working through a tutorial on making a Twitter client for iPhone, nothing special just trying to figure out a bit more about xcode before buying books etc to learn about it

http://www.yousendit.com/download/UFVxQ3Q1TlFTSUJFQlE9PQ

That is a link to my current file, it is saying that I have undeclared my username and password and I would greatly appreciate any light that anyone can shed on my particular problem

:) Thanks guys

Phil

+3  A: 

Username and Password are not objects. Here is the code he is talking about.

- (IBAction) postTwitter: (id)sender{

    TwitterRequest * t = [[TwitterRequest alloc] init];
    t.username = username.text;
    t.password = password.text;

    [t statuses_update:tweetmessage.text delegate:self requestSelector:@selector(status_updateCallback:)];
}

Your TwitterRequest object has a username and password property, so that is fine. But username and password are not local objects to this class. What you need to do is either:

- (IBAction) postTwitter: (id)sender{

TwitterRequest * t = [[TwitterRequest alloc] init];
t.username = @"USERNAME HERE"
t.password = @"PASSWORD HERE"

[t statuses_update:tweetmessage.text delegate:self requestSelector:@selector(status_updateCallback:)];  

}

OR you need to declare IBOutlets for 2 UITextField in your XIB and connect them. Like so.

Header File:

        #import <UIKit/UIKit.h>


    @interface TweetViewController : UIViewController {


        IBOutlet UITextField *tweetmessage;
        IBOutlet UITextField *username;
            IBOutlet UITextField *password;
    }

- (IBAction) postTwitter: (id) sender;
- (IBAction) login;

@end

If you do this you can leave your code as it.

Collin Ruffenach
You sir are a gentleman, I feel stupid as this is a very noob mistake! Thanks for the advice it is greatly appreciated!
Phil Hopper