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: Sun, 10 Nov 2002 12:47:53 -0700
Ack, at 11/10/02, Ondra Cada said:
if (NSClassFromString(@"RKAlias")==NULL)
For a class there is the "Nil" constant -- "NULL" belongs to pointers.
There's really no difference. I've always used NULL since it's
defined in plain old C. Then again, I don't use nil either.
#define nil 0
#define NULL 0
#define Nil 0
The only person it matters to is the person reading the code.
{
NSBundle* rkBundle=[NSBundle bundleWithPath:[NSString
stringWithFormat:@"%@/%@",[thisBundle
It's not that good to create paths manually this way. See
stringByAppendingPathComponent: and similar methods.
I could, but what exactly would be the difference?
privateFrameworksPath],@"Protocol7Additions.framework"]];
[rkBundle load];
RKAliasClass=NSClassFromString(@"RKAlias");
This line seems to be kinda superfluous, since...
}
RKAliasClass=(NSClassFromString(@"RKAlias"));
...this is performed immediately afterwards. Also, why the parentheses?!?
I... have... no... clue. I didn't even see that extra
NSClassFromString() It's completely useless. Thanks for pointing it
out. I think it's a relic from when I was printing it out...
NSLog(@"%@",NSStringFromClass(NSClassFromString(@"RKAlias))) would
tell me if the class was loaded, the %@ was so NSLog would print
(null) if it wasn't.
That all said, the general pattern is quite sound, although I would
rather encapsulate it this way:
<snip>
But what if the class hasn't been loaded?
--
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.