Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > WebObjects Developer's Guide


Table of Contents Previous Section

Accessing WebScript Methods From
Objective-C Code

As stated previously, you can mix WebScript and Objective-C code. Often, programmers use WebScript for component logic, and then supply the bulk of the application (the "business logic") in compiled code.

To access Objective-C code from a WebScript file, you simply use the Objective-C class like any other class:

id myObject = [[MyCustomObjCClass alloc] init];
To access a WebScript object from Objective-C code, you simply get the object that implements the method and send it a message. If you're accessing a method in the application script, you can use this WOApplication method to access the object:

[[WOApplication application] applicationScriptMethod];
To avoid compiler warnings when accessing WebScript objects from Objective-C, create a header file for the scripted component as though it were compiled. This step isn't strictly required, of course-your code will still build, you'll just get warnings.

Table of Contents Next Section