PDA

View Full Version : Making Objective-C Cocoa and EOF work together.




GeeYouEye
Apr 17, 2006, 01:39 PM
For anyone who's interested.

You will need: the headers from the EOAccess and EOControl frameworks.

1. Put the headers back into the frameworks. It wasn't very nice of Apple to remove them for WebObjects 5.3, IMO, but they were around in 5.2.4. The binaries in the 5.3 and 5.2.4 frameworks are identical, so except for possible permissions problems, this should have no untoward effect.

2a. Close XCode, Interface Builder, and EOModeler if they're open.

2. Drill down to /Developer/Applications/WebOjects/EOModeler.app/Contents/Resources/English.lprog/ and open EOModeler-macos.nib. Add a menu item under Property called "Generate Obj-C Files..." and connect it to FirstResponder, set the action to createTemplate:

3. Save and Quit Interface Builder.

4. Create a model as normal in EOModeler. Attention may need to be paid to less used aspects of the model, such as Value Class, Value Type, and Write Format for attributes.

5. Create a Cocoa application in XCode.

6. Add the frameworks to your project. You may need to copy them, though that may be an artifact of the way I arrived at these instructions.

7. Add the model to your project.

8. Generate Objective-C files from within EOModeler. Add them to the project when prompted.

9. Back in XCode, make sure to add the new files to the target, as EOModeler will not do this for you.

10. In your application controller, you will need to initialize the model. I used an ivar for the model itself. The way I did it was model = [[EOModel alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"model" ofType:@"eomodeld"]];

That's it. Now go make your application. Most of the Java documentation applies, but you can also read the framework headers for insight.

My next project: an EOF-CoreData converter.

Apple, if you read this, please don't break this in the next OS or dev tools release. I'm really enjoying using this.



bitviper
Feb 26, 2008, 10:17 PM
Hello,

I'm using XCode 2.4 and webobjects on Tiger. How to I instantiate the java class files within xcode? I am a newby. I would appreciate your help, as there does not seem to any knowledgeable person on EOF and Cocoa.

Thanks in advance.





For anyone who's interested.

You will need: the headers from the EOAccess and EOControl frameworks.

1. Put the headers back into the frameworks. It wasn't very nice of Apple to remove them for WebObjects 5.3, IMO, but they were around in 5.2.4. The binaries in the 5.3 and 5.2.4 frameworks are identical, so except for possible permissions problems, this should have no untoward effect.

2a. Close XCode, Interface Builder, and EOModeler if they're open.

2. Drill down to /Developer/Applications/WebOjects/EOModeler.app/Contents/Resources/English.lprog/ and open EOModeler-macos.nib. Add a menu item under Property called "Generate Obj-C Files..." and connect it to FirstResponder, set the action to createTemplate:

3. Save and Quit Interface Builder.

4. Create a model as normal in EOModeler. Attention may need to be paid to less used aspects of the model, such as Value Class, Value Type, and Write Format for attributes.

5. Create a Cocoa application in XCode.

6. Add the frameworks to your project. You may need to copy them, though that may be an artifact of the way I arrived at these instructions.

7. Add the model to your project.

8. Generate Objective-C files from within EOModeler. Add them to the project when prompted.

9. Back in XCode, make sure to add the new files to the target, as EOModeler will not do this for you.

10. In your application controller, you will need to initialize the model. I used an ivar for the model itself. The way I did it was model = [[EOModel alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"model" ofType:@"eomodeld"]];

That's it. Now go make your application. Most of the Java documentation applies, but you can also read the framework headers for insight.

My next project: an EOF-CoreData converter.

Apple, if you read this, please don't break this in the next OS or dev tools release. I'm really enjoying using this.