> 
> 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.


I have two nibs, two targets and everything is fine, but I'd like to be able
to combine common code.

So each nib has:
ControllerUnique
ControllerA
ControllerB
ControllerC

A B and C are the same between both versions. The ControllerUnique is
different because one has to be an app delegate and one has to be a prefPane
delegate with different methods to support each.

A B and C need IBOutlets to point to ControllerUnique so that they can talk
to it.

So if I make the nibs use AppControllerUnique and PaneControllerUnique then
how can A B C point to them? Because inside A B and C there will be an
IBOutlet that in one case needs to point to an AppControllerUnique but in
the other has to point to a PaneControllerUnique.



I could of course combine AppControllerUnique and PaneControllerUnique  and
call it ControllerUnique with #ifdefs to split the code, but there is no way
to make an IBAction available in only one version... Since IB does not
recognize the #ifdef which would prevent a Sparkle IBAction from showing up
in the AppStore nib (even though the code could be compiled out.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to