• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "weak link" framework refs for 10.1 compatibility?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Follow-Ups:
    • Re: "weak link" framework refs for 10.1 compatibility?
      • From: Ondra Cada <email@hidden>
References: 
 >Re: "weak link" framework refs for 10.1 compatibility? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Setting up a Creator/Mine type
  • Next by Date: Re: "weak link" framework refs for 10.1 compatibility?
  • Previous by thread: Re: "weak link" framework refs for 10.1 compatibility?
  • Next by thread: Re: "weak link" framework refs for 10.1 compatibility?
  • Index(es):
    • Date
    • Thread