Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem getting main bundle inside initWithCoder:



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.