Re: "weak link" framework refs for 10.1 compatibility?
Re: "weak link" framework refs for 10.1 compatibility?
- Subject: Re: "weak link" framework refs for 10.1 compatibility?
- From: Rosyna <email@hidden>
- Date: Sat, 9 Nov 2002 21:30:58 -0700
Something like this? (for my class)
-(void)getRKAliasClass
{
thisBundle=[NSBundle bundleForClass:[self class]];
if (NSClassFromString(@"RKAlias")==NULL)
{
NSBundle* rkBundle=[NSBundle bundleWithPath:[NSString
stringWithFormat:@"%@/%@",[thisBundle
privateFrameworksPath],@"Protocol7Additions.framework"]];
[rkBundle load];
RKAliasClass=NSClassFromString(@"RKAlias");
}
RKAliasClass=(NSClassFromString(@"RKAlias"));
NSLog(@"%@",NSStringFromClass(RKAliasClass));
}
RKAliasClass would be NULL if it hasn't loaded. Replace with the
requisite framework paths and then uhh, use the constants if the
class exists? As long as you compile on 10.2...
Would this work in your case?
Ack, at 11/7/02, Dan Wood said:
I'm trying to add some AddressBook framework and NSAppleScript
functionality to my app, but still allow for 10.1 compatibility.
I'm making sure that no 10.2-specific methods get called in my code,
and that's straightforward, but what is a problem is the constants
(e.g. the Address Book constants in ABGlobals.h, or
NSAppleScriptErrorMessage) are declared within the frameworks, that
cause the bundle not to load in 10.1.
I've found a workaround is to use my own string constants -- e.g.
@"NSAppleScriptErrorMessage" instead of NSAppleScriptErrorMessage --
but that seems like such a hack. Is there a better way around this
problem, like some sort of "weak linking" (for lack of a better
term) that will cause the code not to complain that it can't find
the string constants in the 10.1 frameworks, since the code will
never be executed?
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it helps me
remember what we were talking about. Thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.