FROM : Michael Ash
DATE : Sat Jun 21 22:41:52 2008
On Sat, Jun 21, 2008 at 3:51 PM, Jacob Bandes-Storch <<email_removed>> wrote:
> I'm working on a project (with another developer) that will target OSes
> older than 10.5, and I'd like to use the Leopard-only NSWindow method
> -setCollectionBehavior:. As far as I know, the best way to do this is to
> check for the method using -respondsToSelector:. I need to use the enum type
> NSWindowCollectionBehavior. When I try this, I get an error saying "error:
> 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this
> function)" and a warning "warning: 'NSWindow' may not respond to
> '-setCollectionBehavior:'". This is because I'm using the 10.4 SDK... I've
> read in some places to set the "Cross-develop using target SDK" setting of
> the project to 10.5, but that setting is not available in the General tab of
> the project info. Does anyone know how to do this properly without angering
> the compiler?
Just copy the enum's value into your own code. There is no risk of
binary compatibility problems in this scenario because that's what the
compiler does when it sees an enum anyway. You don't want to copy the
value of, say, an NSString constant whose value isn't exposed in the
header, but any number you see defined in the header is fair game.
Mike
DATE : Sat Jun 21 22:41:52 2008
On Sat, Jun 21, 2008 at 3:51 PM, Jacob Bandes-Storch <<email_removed>> wrote:
> I'm working on a project (with another developer) that will target OSes
> older than 10.5, and I'd like to use the Leopard-only NSWindow method
> -setCollectionBehavior:. As far as I know, the best way to do this is to
> check for the method using -respondsToSelector:. I need to use the enum type
> NSWindowCollectionBehavior. When I try this, I get an error saying "error:
> 'NSWindowCollectionBehaviorCanJoinAllSpaces' undeclared (first use in this
> function)" and a warning "warning: 'NSWindow' may not respond to
> '-setCollectionBehavior:'". This is because I'm using the 10.4 SDK... I've
> read in some places to set the "Cross-develop using target SDK" setting of
> the project to 10.5, but that setting is not available in the General tab of
> the project info. Does anyone know how to do this properly without angering
> the compiler?
Just copy the enum's value into your own code. There is no risk of
binary compatibility problems in this scenario because that's what the
compiler does when it sees an enum anyway. You don't want to copy the
value of, say, an NSString constant whose value isn't exposed in the
header, but any number you see defined in the header is fair game.
Mike
| Related mails | Author | Date |
|---|---|---|
| Jacob Bandes-Storc… | Jun 21, 21:51 | |
| Mark Munz | Jun 21, 22:01 | |
| Michael Ash | Jun 21, 22:41 | |
| Mike Abdullah | Jun 21, 22:56 |






Cocoa mail archive

