• 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
NSString category name collision?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString category name collision?


  • Subject: NSString category name collision?
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 26 Jan 2010 16:08:52 +0000

I have defined a category on NSString which includes the following signature.

- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet *) set withString:(NSString *) string

On occasion I encounter the exception listed below where an OSAKit private method calls the same method (and triggers the exception).

Is this a collision between my category method and one presumably/perhaps defined by the OSAKit?

The docs say:

A category cannot reliably override methods declared in another category of the same class.
This issue is of particular significance since many of the Cocoa classes are implemented using categories.
A framework-defined method you try to override may itself have been implemented in a category, and so which implementation takes precedence is not defined.

Is this just one of the things we have to put up with as the price for dynamism or can this problem be pre-empted?

I added a name space prefix to my method definition and the exception departed.

*** -[NSCFString rangeOfCharacterFromSet:options:range:]: Range or index out of bounds

-[NSString rangeOfCharacterFromSet:options:range:] (in Foundation) 133
-[NSMutableString(Mugginsoft) replaceCharactersInSet:withString:] (in MGSKosmicTask) (NSString_Mugginsoft.m:220)
-[NSString(Mugginsoft) stringByReplacingCharactersInSet:withString:] (in MGSKosmicTask) (NSString_Mugginsoft.m:203)
[OSADictionary(OSAPrivate) anchorFromName:] (in OSAKit) 53
-[OSADictionary(OSAPrivate) parseData:error:] (in OSAKit) 1180


Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com






_______________________________________________

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

  • Follow-Ups:
    • Re: NSString category name collision?
      • From: "Sean McBride" <email@hidden>
    • Re: NSString category name collision?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Debugging auto_zone_resurrection_error in Core Data using GCD
  • Next by Date: Re: How to access iTunes using cocoa
  • Previous by thread: Re: Debugging auto_zone_resurrection_error in Core Data using GCD
  • Next by thread: Re: NSString category name collision?
  • Index(es):
    • Date
    • Thread