Re: IBOutlet to different classes, conditional build
Re: IBOutlet to different classes, conditional build
- Subject: Re: IBOutlet to different classes, conditional build
- From: Graham Cox <email@hidden>
- Date: Thu, 24 Feb 2011 12:21:29 +1100
On 24/02/2011, at 11:23 AM, Trygve Inda wrote:
> So when I define MyCommonAppDelegate in the nib, it should only have the
> "SparkleUpdate" IBAction in the retail version... So this code really sits
> in MyPrefPaneDelegate... But how do I get IB to realize this?
>
> I am really trying not to have any duplicated code here.
You probably need to have two nibs.
In your project you'll have two targets, one for App Store, one not. If you show Target Membership for the source list, you can check the membership box against the appropriate nib for each target.
It's also hard to avoid conditional compilation unless you factor out your code into separate files (categories perhaps) and use the same target membership to choose which code is included in which target. However, conditional compilation isn't too bad - just add some constant to one of the target's 'preprocessor macros' and then you can conditionally compile based on that using #ifdef.
You can also use the Target Membership to drop out the Sparkle framework from the App Store build. Note that there's no need to conditionally remove Sparkle-related code from your app such as its delegate methods and so on. If the user doesn't have the menu commands, and the framework isn't there, the code will never be called.
--Graham
_______________________________________________
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