[MacRuby-devel] Document-Based Application Issues

Mike Leonard mikeleonard at gmail.com
Tue Jul 13 15:33:42 PDT 2010


Could be, but I don't think I did anything differently, wiring wise, the second time. At any rate, if the same thing happens again I'll have a better idea of where exactly things went south. Thanks for your assistance.

On Jul 13, 2010, at 3:26 PM, Laurent Sansonetti wrote:

> Hi Mike,
> 
> Glad to know it works with the template. I suspect you were missing some wirings in IB in your first attempt. 
> 
> Laurent
> 
> On Jul 13, 2010, at 1:23 PM, Mike Leonard wrote:
> 
>> This is peculiar. I created a minimal example for the purpose of responding to your request using just the document-based application template. I added public.plain-text as a document type in my application's properties and a single line of code to MyDocument.rb:
>> 
>> 	def readFromData(data, ofType:type, error:outError)
>> 		puts "readFromData"
>> 		outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4, userInfo:nil))
>> 		nil
>> 	end
>> 
>> Based on what was happening in my original attempt, when I did File > Open, I didn't expect to see "readFromData" on the terminal. But there it was. So something I did in my original app must have screwed this up. The thing is, I have no idea what. I did delete the readFromData method because I intended to use readFromURL instead, but then I ended up deciding to go with readFromData after all and reinstated it. I guess I'll just start over with a new template and see if the problem occurs again.
>> 
>> Thanks,
>> 
>> Mike
>> 
>> 
>> On Jul 13, 2010, at 1:02 PM, Laurent Sansonetti wrote:
>> 
>>> Hi Mike,
>>> 
>>> It's hard to tell at the first glance, could you post your code somewhere so that we can have a look?
>>> 
>>> Laurent
>>> 
>>> On Jul 13, 2010, at 9:32 AM, Mike Leonard wrote:
>>> 
>>>> Hello all,
>>>> 
>>>> Apologies if this is really obvious; my background is mainly in Ruby, though I do have some experience developing a Cocoa document-based app.
>>>> 
>>>> Anyway, I'm trying to create a document-based application from the MacRuby template. Things started out well, but I hit a snag when I tried to get my app to actually open files. When I do File > Open, an NSOpenPanel pops up as expected, but after I select a file I just get a dialog telling me that the file could not be opened. In fact, the "readFromData(data, ofType:type, error:outError)" method never seems to execute at all.
>>>> 
>>>> I'm sure this is something simple. I've basically been trying to apply the techniques in Apple's "Building a Text Editor in 15 Minutes" document to a MacRuby document-based app. Do I need to subclass NSDocumentController or something?
>>>> 
>>>> Thanks,
>>>> 
>>>> Mike Leonard
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list