Frameworks part uno

As with the CoreData entry I’m going to keep this as a running tips/reminders on creating frameworks.  There seems to be a real lack of information regarding them.  Some of the things that seem basic don’t appear to be documented.

  • NSApp is the application that loaded the framework.  So a call like [NSApp applicationIconImage]; returns the app’s icon and not some generic icon for the framework.
  • [NSBundle mainBundle] returns the app’s bundle which is great for loading items like the info dictionary.  If a nib or another resource needs to be loaded from the framework, something like [NSBundle bundleForClass:[self class]] needs to be used.
  • Calls to pathForAuxiliaryExecutable will not return tools that are inside the framework. Use pathForResource:ofType: on the framework’s bundle instead.

More to come

Leave a Reply