Problems in NSDocument application #1

akosma opened this Issue Jul 18, 2010 · 5 comments


None yet
2 participants

akosma commented Jul 18, 2010

When using Fragaria in a document-based Cocoa application (where the Fragaria editor is embedded into an NSView in the document window), the first document opens without problems, but when trying to open another one, the app crashes. The error has to do with the "setObject" method. Furthermore, the application crashes when the user scrolls the view, and it does not perform syntax highlighting either. The application itself consists of a simple NSDocument-based application with the code in the sample app provided with the framework. Any idea? Thanks.


mugginsoft commented Jul 24, 2010

I am not my self convinced that setObject:forKey: is the best design approach here but it seemed like a good fit with the original core data based model. I will refractor the sample app as a NSDocument based app and hopefully the issues you described will emerge and can be addressed.

Sorry for the delay in replying.

akosma commented Jul 24, 2010

No problem! Thanks for the input.


mugginsoft commented Jul 27, 2010

The repo should now include an ultra simple app target that utilises NSDocument.
This does not seem to exhibit the basic problems you describe.

Make sure that you do not assign a delegate to the underlying NSTextView as this will replace the existing SMLSyntaxColouring instance.

Use [fragaria setObject:self forKey:MGSFODelegate]; to assign a delegate instead. Note that at present this provides few callbacks (you get - (void)textDidChange:(NSNotification *)notification and that's about it).

If trouble still abounds you can, if you wish, send me your code and I will take a look.

akosma commented Jul 28, 2010

Thanks! I'll take a look at it now.

akosma commented Jul 28, 2010

It works! I've added Fragaria as a submodule in my own project nib2objc :) to show the contents of NIB files as colored ObjC code. Thanks!

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment