Xcode - "Preference Pane" project - how to access bundle?

Posted by Nippysaurus on Stack Overflow See other posts from Stack Overflow or by Nippysaurus
Published on 2010-12-27T11:40:40Z Indexed on 2010/12/27 11:53 UTC
Read the original article Hit count: 495

Filed under:
|

I have created a "Preference Pane" project. In this project I would like to load an image from my bundles resources folder. This seems difficult because "[NSBundle mainBundle]" seems to return the following:

27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </Applications/System Preferences.app> (loaded)

Iterating through "[NSBundle allBundles]" reveals that my projects bundle appears, but does not appear to be loaded:

27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Mouse.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Sound.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Spotlight.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/TimeMachine.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </Library/PreferencePanes/DivX.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Trackpad.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/UniversalAccessPref.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Dock.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/DateAndTime.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Keyboard.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/MobileMe.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/FibreChannel.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Appearance.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/DigiHubDiscs.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Ink.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Security.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/EnergySaver.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Speech.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </Users/michael/Library/PreferencePanes/MyPrefPane.prefPane> (loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </Users/michael/Code/MyPrefPane/build/Debug/MyPrefPane.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/SharingPref.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Expose.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/SoftwareUpdate.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/ParentalControls.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/PrintAndFax.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Accounts.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Bluetooth.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Localization.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/StartupDisk.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Network.prefPane> (not yet loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </Applications/System Preferences.app> (loaded)
27/12/10 9:24:18 PM System Preferences[5076]    NSBundle </System/Library/PreferencePanes/Displays.prefPane> (not yet loaded)

I'm not sure whats going on here. How can I access my prefpane bundle?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsbundle