Re: Stumped: How to call a function defined in a Framework?
Re: Stumped: How to call a function defined in a Framework?
- Subject: Re: Stumped: How to call a function defined in a Framework?
- From: Chris Espinosa <email@hidden>
- Date: Thu, 4 Dec 2008 23:49:10 -0800
On Dec 4, 2008, at 11:38 PM, JK wrote: Hello fellow Xcode users,
I'm having a problem calling a function in a Framework; the compiler complains about an undeclared type. I must be doing something wrong, but I have no idea what...
Here are the steps to repeat the problem:
1. Start Xcode 3.1.2 (I am running Leopard 10.5.5) 2. Create a new Cocoa Document-Based application project. 3. In the file "MyDocument.m", add the line "SecuritySessionId mySession;" to the "init" method, so that it looks like:
- (id)init { SecuritySessionId mySession; self = [super init]; if (self) {
// Add your subclass-specific initialization here. // If an error occurs here, send a [self release] message and return nil.
} return self; }
4. Also in "MyDocument.m", add the line "#import <Security/Security.h>" immediately after the line "#import "MyDocument.h"".
5. Add the "Security.framework" to the "Other Frameworks" folder in the "Groups & Files" list in the project window.
6. Build the project.
The compiler complains with the following message:
error: 'SecuritySessionId' undeclared (first use in this function)
My question: What else is necessary to make this compile correctly?
I have never been able to build a project that references functions in Frameworks that are not included in the default project.
Thanks in advance for any help you can provide,
In most cases, including the framework's master header (in this case, #import <Security/Security.h> is enough to get all the definitions you'll ever need out of the framework. But the symbol you're using is in a header file that has the comment:
The Session API provides specialized applications access to Session management and inquiry functions. This is a specialized API that should not be of interest to most people.
And it is not included by Security.h.
So you need to explicitly #import <Security/AuthSession.h> in your source file.
But before you do that, you need to ask yourself if going off the beaten path is really what you want to do, and what problem you're trying to solve that inclines you to use a specialized API.
Chris |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden