Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSOpenPanel may not respond to setDirectoryURL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOpenPanel may not respond to setDirectoryURL?



Time for me to be cruel and pick apart your code.

On 8 Mar 2012, at 18:10, Howard Moon wrote:

> Hmmm... I'm building a VST3/vstgui4 plug-in, and I think the base SDK and deployment targets are set as required, like this:
>
> SDKROOT = macosx10.5
> SDKROOT[arch=x86_64] = $(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk
>
> When I build either a 32-bit or 64-bit build, while running on 10.6, it executes -setDirectoryURL with no problems.  I haven't tried running in 10.5 yet.
>
> Can I keep my above settings, but do this?
>
> 	if ([openPanel respondsToSelector:@selector(setDirectory)])

-setDirectory: is available on all OS releases. Just because it has been deprecated does not stop it existing! You want to test the -setDirectoryURL: selector instead.

> 		[openPanel setDirectory:nsParentPath];
> 	else
> 	{
> 		NSURL*	nsParentURL		= [NSURL fileURLWithPath:nsParentPath isDirectory:YES];
> 		[openPanel setDirectoryURL:nsParentURL];
> 		//[nsParentURL release]; // No...crashes! must be used by panel

That you have this code/comment shows you clearly don't understand Cocoa memory management yet. Please, please, please re-read the docs and take the time to understand it. That line of code crashing has NOTHING to do with the open panel.
> 	}




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >NSOpenPanel may not respond to setDirectoryURL? (From: Howard Moon <email@hidden>)
 >Re: NSOpenPanel may not respond to setDirectoryURL? (From: Mike Abdullah <email@hidden>)
 >Re: NSOpenPanel may not respond to setDirectoryURL? (From: Howard Moon <email@hidden>)
 >Re: NSOpenPanel may not respond to setDirectoryURL? (From: Mike Abdullah <email@hidden>)
 >Re: NSOpenPanel may not respond to setDirectoryURL? (From: Howard Moon <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.