The document doesn't pop up a new window. The delegate does get called, but doc is nil. But, if I use [[NSWorkspace sharedWorkspace] openFile:path withApplication:@"MyAppName"], it works.
I just thought that I shouldn't have to rely on NSWorkspace.

I will try your suggestion of using the newer method. I thought that the fileURLWithPath includes "file://" that I don't want. Other examples show URLWithString, too.

Thanks, Quincey.

On Jan 11, 2010, at 12:41 PM, Quincey Morris wrote:

On Jan 11, 2010, at 05:43, Jeffrey Andrews wrote:

I am stumped. I am trying to open another document from within a document. My AppController implements the delegate method

-(BOOL) application:(NSApplication*) sender openFile:(NSString*)path
{
        NSLog(@"AppController - application:openFile - %@", path);
NSDocumentController* dc = [NSDocumentController sharedDocumentController]; id doc = [dc openDocumentWithContentsOfURL:[NSURL URLWithString:path] display:YES];
        return (doc != nil);
}

...

How else should I handle opening another window with the file specified?

Yes, but you didn't say what happens. Does the delegate method get invoked? Is 'doc' nil? What happens if you use the non-deprecated 'openDocumentWithContentsOfURL:display:error:' instead? Is there an error returned? Shouldn't you be using 'fileURLWithPath:' instead of 'URLWithString'? Etc, etc.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jeffrey%40quackerjack.com

This email sent to [email protected]


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to