Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- Subject: Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
- From: Quincey Morris <email@hidden>
- Date: Wed, 07 Sep 2011 10:44:41 -0700
On Sep 7, 2011, at 10:06 , Sean McBride wrote:
> Not to speak for the OP, but I am in the same situation as him.
If the "situation" you mean is what you describe in the rest of your post, you're not in the same situation. The OP's very first sentence was:
> On Sep 6, 2011, at 03:33 , Oleg Krupnov wrote:
>
>> I'm implementing a new Lion's API, namely the resume.
That is, the OP was opting in, not opting out.
> It's not a case of "trying to take advantage of 10.7 features", it's a case of 10.7's "Resume" feature breaking *binary* compatibility of apps built with 10.6 deployment & 10.6 SDK.
>
> My app, and others I've used, and probably the OP's, were broken by Resume (basically because it's opt-out, not opt-in).
Well, if that's so, consider what you're saying: Lion *broke binary compatibility with 10.6 applications*. If true, that's not at all what this thread is about. It's also a *much* more serious problem. (Technically serious, I mean. The practical effect is a different question.)
> To "fix" this fast for a dot release (that's built on 10.6-based buildbots) the easiest thing to do is to opt out of Resume, and to do that one must call setRestorationClass:, setRestorable:, etc.
>
> If Apple had provided the ability to opt out using an Info.plist key, as was suggested by many during the seed phase <rdar://9589219>, we would not be having this discussion.
>
> Another point: upping your min SDK requirement means that all your coworkers, build machines, etc. must also update. If you deploy to 10.6, it means you sometimes need to debug on 10.6, and doing that is a PITA if you can't tweak code and rebuild. If you require 10.7 SDK, how do you do that?!
>
> My solution is as others have said, namely:
>
> // If the SDK being compiled against is older than the 10.7 SDK...
> #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
>
> @interface NSWindow (RRRestorationHackForOldSDKs)
> - (void)setRestorationClass:(Class)restorationClass;
> - (void)setRestorable:(BOOL)flag ;
> - (void)invalidateRestorableState;
> @end
>
> #endif
>
> if ([window respondsToSelector:@selector(setRestorationClass:)] &&
> [window respondsToSelector:@selector(setRestorable:)] &&
> [window respondsToSelector:@selector(invalidateRestorableState)])
> {
> [window setRestorationClass:Nil];
> [window setRestorable:NO];
> [window invalidateRestorableState];
> }
Again, the point of this thread is that the above general technique is not the correct way to opt *in* to a Lion feature. However, if you're trying to opt *out* in order to work around the claimed Lion bug, then I don't see how there can be any pragmatic objection to your taking this approach.
_______________________________________________
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