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


One thing I am running into:

I have

#ifdef RETAIL
@interface MyObjectClass : NSPreferencePane
#endif

#ifdef APPSTORE
@interface MyObjectClass : NSObject
#endif
{
    stuff here
}

I get errors in IB like: "cannot integrate class information because the
declarations have different superclasses.

I need one nib to contain an instance of MyObjectClass (asa  subclass of
NSObject) and a different nib to contain an instance of MyObjectClass (as a
subclass of NSPreferencePane).

MyObjectClass uses conditional code so that the version that is a subclass
of NSPreferencePane  has methods like willSelect while the other version has
stuff like applicationDidFinishLaunching

It seems however that IB can only see it one way even if they are in
different nibs.

In either case, the two nibs also contain ClassA, ClassB, ClassC all of
which are subclasses of NSObject. These three classes need to have an
IBOutlet to MyObjectClass.

So I need:

Nib #1                        Nib#2
MyObjectClass : NSObject      MyObjectClass : NSPreferencePane
ClassA                        ClassA
ClassB                        ClassB
ClassC                        ClassC

Classes A B C are totally identical, while MyObjectClass has 3 or 4 methods
specific to the nib and 10 other common methods.

How can I properly set this up?

T.





_______________________________________________

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