25

All that I know is this:

  • Its private
  • Its created somehow cause of strings trying to do Path related things

I mean, if they are private and still my app is telling me that NSPathStore2 is interfering, I need to know why. I just want to understand why a release of NSPathStore2 is making my app crash.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
CalixJumi
  • 367
  • 3
  • 12
  • 2
    Where's the code? What are you doing to trigger the release of that private class object? – Flyingdiver Sep 01 '11 at 15:26
  • Paths are arguments to file methods. Like NSFileHandle. So where are you doing file operation? – Flyingdiver Sep 01 '11 at 16:50
  • 2
    I postulate that the question is useful, but is formed improperly. The real question here is "What type of object is an NSPathStore2 object and how should I expect to be able to treat it. With THAT as the question, the accepted answer becomes very relevant. – Norman H Feb 15 '13 at 15:30
  • Just edited it to fit better. 7 upvotes show it's a valid question. – Mike Lischke Feb 23 '14 at 09:43
  • Probably you are making a mistake with your code that uses NSStrings (e.g. calling nonexistent function, etc) and seeing an exception mentioning NSPathStore2. NSPathStore2 is not causing the problem. – Colin Jul 19 '14 at 12:15
  • 1
    This should be reopened; I was concerned I wasn't getting strings in my array so I googled the type I saw, and this question is the first result, and the accepted answer completely addresses my concern – Ky - Nov 21 '18 at 21:54

1 Answers1

32

NSPathStore2 is a subclass of NSString, used when creating strings that contain paths. For all intents and purposes, you should treat it as a NSString.

Franci Penov
  • 74,861
  • 18
  • 132
  • 169
  • 1
    Additionally, it's useful to know that `NSString` is referred to as a [class cluster (Apple docs)](https://developer.apple.com/library/ios/documentation/general/conceptual/CocoaEncyclopedia/ClassClusters/ClassClusters.html). `NSPathStore2` is one of many case-specific implementations of `NSString` – Dov Oct 08 '14 at 03:35
  • Well, sadly, that's not entirely correct. My testing found that NSPathStore2 performs normalization operations when comparing it against paths that a regular NSString object would not do. Even worse, it normalizes paths when using "hasPrefix" but not when using "isEqualToString", causing quite some ugly effects when you're not prepared for this. – Thomas Tempelmann Nov 30 '20 at 20:29
  • I'm also finding it can cause a crash when using a category extension on NSString that doesn't exist on an NSPathStore2 “subclass”. Not sure the details, but it doesn't seem like it behaves exactly like an NSString. – Peter N Lewis Jun 14 '23 at 02:23