views:

1798

answers:

1

I just created a new Cocoa project on XCode 3.2. I'm running it in Snow Leopard.

When I build it for 10.6 it works fine but if I change the active SDK to 10.5 I get this error:

cannot find protocol declaration for 'NSApplicationDelegate'
+16  A: 

NSApplicationDelegate is a new protocol as of 10.6. You're getting the error (I'm guessing) because your application delegate is implementing this protocol. I'm not sure if this is the best practice on this, but you might just consider using the preprocessor to help you:

#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
@interface MyAppDelegate : NSObject
#else
@interface MyAppDelegate : NSObject <NSApplicationDelegate>
#endif
nall
If i compile for 10.5 I'm getting same error message in xcode
Jorge
Ha, my bad. MAC_OS_X_VERSION_10_6 isn't defined on 10.5, so we have to keep the logic in terms of 10.5. Fixed in the answer.
nall
Thanx this worked for me. Jorge you need to accept this answer!
Raj