Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

youngplayer

macrumors member
Original poster
May 16, 2008
36
0
Shanghai,China
I'm following the guide from developer.apple.com to implement a PreferencePane.

I create a cocoa bundle project, and add the PreferencePanes framework.
And then, I create a class MyPreferencePane inheriting class NSPreferencePane.
It's strange that there's no prompt from the code sense when I type NSPreferencePane. So, I guess there're some problem happened. When I compile the project, there occur four errors:
1) NSPreferencePane.h:No such file or directory
2) Can't find interface declaration for 'NSPreferencePane'

Both of the above errors occured twice.

These errors seem invoked by no PreferencePane class found. But I have added PerferencePanes framework. How can these errors happen? I'm so puzzled.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
NSPreferencePane.h is part of the PreferencePanes.framework framework. Is this included in your project? It's part of the PreferencePane project template, but not any other template. If you chose Cocoa bundle or any project template other than PreferencePane you'll have to add it yourself.
 

youngplayer

macrumors member
Original poster
May 16, 2008
36
0
Shanghai,China
NSPreferencePane.h is part of the PreferencePanes.framework framework. Is this included in your project? It's part of the PreferencePane project template, but not any other template. If you chose Cocoa bundle or any project template other than PreferencePane you'll have to add it yourself.

I have added PreferencePane framework. Is it enough? What else should I do?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
How to add it by myself? I'm not sure how to do according to your first advice

I'm at work so I can't post the exact steps (not on a Mac), sol read the XCode documentation. It's there to tell you how to use the IDE.

In general you should be able to drag it from the Finder to the Frameworks section of the project.
 

youngplayer

macrumors member
Original poster
May 16, 2008
36
0
Shanghai,China
I'm at work so I can't post the exact steps (not on a Mac), sol read the XCode documentation. It's there to tell you how to use the IDE.

In general you should be able to drag it from the Finder to the Frameworks section of the project.

Ok, let me show my steps to add the PreferencePanes framework:
1) Right click the "Linked Frameworks", and select "Add" -> "Existing Frameworks"
2) Select PreferencePanes.framework from the Library/Frameworks folder
3) Press "Add" button. And then, the "PreferencePanes.framework" is shown in the "Linked Frameworks"

After that, the guide tells "Drag the header file to the nib's main window in IB". I failed to do this, because the guide is based on Project builder which may be different from Xcode which I'm using.

What's the corresponding action in Xcode to the action "Drag the header file to the nib's main window in IB" in Project builder?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.