Login

Objective-C

Objective-C and Xcode Essential Training

Objective-C and Xcode Essential Training


Objective-C is a fun and exciting language to program with. It is also the de-facto language used to program on the Mac, iPod, iPhone and iPad. This course focuses on the Objective-C language and building simple applications for the desktop. Many Objective-C classes and development techniques are explored. Whether you are wanting to build applications for the desktop or the mobile devices, this is the first step and it will get you started on the path to becoming a Cocoa programmer! Work files are included. To begin learning today, simply click on the movie links.
 

Calling AppleScriptObjC files from Objective-C

Click here to see a sample application hosted on GitHub. Accessing Objective-C from inside your AppleScriptObjC files is very straight forward and works just as you would expect. Going the other way is not as intuitive but it is simple.

The first thing is to import the AppleScriptObjC framework into your project.
Right-click on Frameworks and choose Add Exisiting Frameworks.

Next, change the main.m file as follows.
#import <Cocoa/Cocoa.h>
#import <AppleScriptObjC/AppleScriptObjC.h>

int main(int argc, char *argv[])
{
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	[[NSBundle mainBundle] loadAppleScriptObjectiveCScripts];
	[pool release];
	
	return NSApplicationMain(argc, (const char **) argv);
}


Objective-C requires that you add an #import statement when accessing methods from another class file. AppleScriptObjC does not have a header file so there is no way to use the #import statement for this purpose.

There are two ways that I know of to accomplish this task. One is using the function NSClassFromString(). The second is to create an IBOutlet and connect to it in Interface Builder.
   

Objective-C Video Series for VTC.com

Update! 2010-02-22 at 1:38 pm MST

Videos are now LIVE at VTC.com! Update! 2010-01-28 at 11:18 pm All videos are now complete! The next process takes a couple of weeks before they are live at VTC. I have been diligently working on a new video series for VTC.com covering Objective-C. There will be over six hours of content covering many Objective-C classes. The largest part of the training will be building a simple Twitter application named TwitterMe.

The functionality of the application will include

  • Verify we have credentials
  • Store credentials
  • Authenticate credentials
  • Ensure there is text to post
  • Determine text count
  • Create TinyURL from url found in text
  • Post update
   

Getting Mouse Coordinates

There was a time when AppleScripters had a cool tool named Extra Suites that, among other things, would get the current mouse coordinates. This osax stopped working with Leopard.

Here is a simple way to replace that functionality. Create a new Xcode project using the Foundation template. Replace the template code with the code below and compile. You now have a foundation tool that will retrieve those mouse coordinates!

   

MacScripterWatcher 3.0.2 Now Open Source!

Stefan Klieme has released MacScripterWatcher 3.0.2 under the GPL license. The source code as well as a binary of the application are included in the download.

MacScripterWatcher is a wonderful application that helps us keep up with the current postings at MacScripter.net.

Anyone wanting to see how a to write solid applications in Objective-C should check this one out!

   

Page 1 of 2

 

Product Categories