In this post I will show you how to make a “Tweeter.” A Tweeter is a simple app that will just send a tweet to your twitter account. Lets get started
What you are going to need:
-Xcode
-MGTwitterEngine
-A Twitter account
Step 1:
Open the MGTwitterEngine project, then open AppController.m.
In the “awakeFromNib” method you will see
NSString *username = @"";
NSString *password = @"";
In between the quotes in the first line put your user name, and in between the quotes in the second line put your password. Now “Build and Run” just to check if everything is working. If there are no errors, move on to Step 2, if there are, make sure you entered your user name and password correctly and that you are connected to the internet.
Step 2:
Open the MainMenu.nib and create a new window. Now add a Wrapping Text Field and a button. I laid mine out like this:

Step 3:
Open AppController.h and add an IBOutlet for your text field. Where you see:
MGTwitterEngine *twitterEngine;
Under that add:
IBOutlet NSTextField *tweetMessage;
Now underneath the “}” add:
-(IBAction)sendTweet:(id)sender;
Step 4:
Re-open AppController.m and add a new method called sendTweet. In this method, you will tell the app to take what you have written in the text field and send it to your twitter account. To do this add:
(IBAction)sendTweet:(id)sender{
[twitterEngine sendUpdate:[tweetMessage stringValue]];
}
Step 5:
Re-open the MainMenu.nib and make all the connections from the AppController object to the window. Save, and close.
Step 6:
Open MGTwitterEngine.m and find this line:
#define DEFAULT_CLIENT_NAME @"MGTwitterEngine"
and change it to:
#define DEFAULT_CLIENT_NAME @"Tweeter"
This will make it so that it will show that your tweet was updated from Tweeter and not MGTwitterEngine.
Step 7:
Find this line:
#define DEFAULT_CLIENT_URL @"http://mattgemmell.com/source"
and change it to:
#define DEFAULT_CLIENT_URL @"http://www.pointlessprogrammers.com"
This will make it so when people click on “Tweeter” it will direct them to this so they can make their own.
Step 8:
Build and Run. Make sure everything is working correctly. If not, go over all the steps again.
Conclusion:
This is a very simple and quick way to make a Tweeter. It is not the best looking app, so go ahead and make any changes you want. You could make it cool looking with my Cocoa Aero guide, or add a counter to make sure you do not go over 140 characters. The possibilities are endless. I’d like to see what you guys come up with so send me a project file (so I know it is legit) with what you have done at jeremy@pointlessprogrammers.com and I’ll feature my favorite one. I will include your website (if you have one) and any other contact info you would like, just be sure to include it in the email.
~Jeremy

how do you download MGTwitterEngine?
1. Open Terminal
2. Type: cd Desktop
3. Hit Enter
4. Type: svn co http://svn.cocoasourcecode.com/MGTwitterEngine-1.0.8/
5. Hit Enter
The directory is on your desktop
You can change the DEFAULT_CLIENT_NAME and URL using properties of the object rather than altering the code base. Also those properties don’t alter what you see in twitter- you used to have to follow the intructions in the MGTwitterEngine readme to apply for an identifier with twitter themselves who will in turn supply you with a token (which you can see in the source code called DEFAULT_CLIENT_TOKEN - again settable using a property of the object)- however twitter’s security has all updated to use OAUTH- and now it doesnt seem to be possible to set a custom source using MGTwitterEngine
-if anyone does know how do let me know- in the interim i just set the token to blank and let it post with a source of “web”.