problem getting main bundle inside initWithCoder:
problem getting main bundle inside initWithCoder:
- Subject: problem getting main bundle inside initWithCoder:
- From: Nick Rogers <email@hidden>
- Date: Tue, 22 Apr 2008 14:05:17 +0530
hi,
here's my initWithCoder: method:-
This method is for a class other then AppController.
- (id)initWithCoder:(NSCoder *)coder
{
if ((self = [super init]) != nil)
{
[self setPath:[coder decodeObjectForKey:@"path"]];
[self setModel:[coder decodeObjectForKey:@"model"]];
[self setSerial:[coder decodeObjectForKey:@"serial"]];
[self setRevision:[coder decodeObjectForKey:@"revision"]];
[self setSizeInSect:[coder decodeObjectForKey:@"sizeInSect"]];
// BAS related
OSStatus junk;
// Create the AuthorizationRef that we'll use through this
application. We ignore
// any error from this. A failure from AuthorizationCreate is very
unusual, and if it
// happens there's no way to recover; Authorization Services just
won't work.
junk = AuthorizationCreate(NULL, NULL, kAuthorizationFlagDefaults,
&gAuth);
assert(junk == noErr);
assert( (junk == noErr) == (gAuth != NULL) );
// For each of our commands, check to see if a right specification
exists and, if not,
// create it.
//
// The last parameter is the name of a ".strings" file that
contains the localised prompts
// for any custom rights that we use.
CFStringRef bundleID = CFBundleGetIdentifier(CFBundleGetMainBundle());
//*** I'm getting correct bundleID here
//*** but the following code fails and bundle is nil after this
CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleID);//
fails
// more code here
}
return self;
}
what could be wrong?
any help would be greatly appreciated.
Thanks,
Nick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden