Andy
Andy

Reputation: 2603

How to write code using ARC feature of Objective C so that it can work on prior version of iOS?

As per my knowledge ARC is available from iOS SDK version 5. So if you are writing an Objective C code using ARC syntax/features...how does one ensure that it works on the prior version of iOS ?

Upvotes: 0

Views: 59

Answers (1)

i_am_jorf
i_am_jorf

Reputation: 54600

Well... #ifdefs, lots of #ifdefs.

For example, from twitter-text-objc:

...
#if !__has_feature(objc_arc)
    [entity autorelease];
#endif
    return entity;
}

Here's an answer you may find relevant.

Upvotes: 1

Related Questions