Question

I noticed two things when switching between iOS and regular OS X development:

//SomeClass.h
@interface SomeClass: SomeUIClass

    @property (retain)SomeProperty* someProperty;

@end

//SomeClass.m
@interface SomeClass ()
{
    SomePrivateVar* somePrivateVar;
}
@end

@implementation SomeClass

@synthesize someProperty;
@end

The above will compile just fine under iOS. That is:

  1. I can synthesize the property without declaring an ivar explicitly in the public @interface
  2. I can further declare other private ivars in the .m file under the anonymous category (class extension).

However, if compiling for OS X and subclassing some NS-based class as opposed to a UI-based one (say, NSView instead of UIView), both the above things result in compiler errors.

I guess I thought Objective-C 2. allowed for the above in general, but they are only "shortcuts" in iOS? or what's the deal with them being allowed in iOS but not in OS X?

Was it helpful?

Solution

Those are features of the "modern runtime" which can only be used for 64 bit apps on Mac OS X. You're probably building a universal binary that also includes a 32 bit version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top