Re: Adding info plist segment for code signing messes up NSBundle
Re: Adding info plist segment for code signing messes up NSBundle
- Subject: Re: Adding info plist segment for code signing messes up NSBundle
- From: Jerry Krinock <email@hidden>
- Date: Sat, 01 Oct 2011 21:45:14 -0700
On 2011 Oct 01, at 19:33, Jim O'Connor wrote:
> Is there some way to get the bundle for the actual surrounding app the way I did before I added the info.plist to my helper apps binary?
I went through this drill a couple years ago. There were gotchas with every option, and after some consideration, I determined that the best option was to, and I know some people will barf at this, do a Method Replacement of -[NSBundle mainBundle].
Weird, though, that in the comment in the header file I imply that if you put your helper in Contents/MacOS you should not need to do this. But since I put my helper in Contents/Helpers for another reason, maybe I did not test that fully, or maybe it's different in Lion.
Anyhow, the app is still shipping and I've had no trouble with this Method Replacement. Yes, if Apple ever changes the hierarchy of MyApp.app/Contents/MacOS, it will fail. Every app is unique and you need to decide if you're OK with this. I don't know if it would meet App Store approval. Method Replacement does not use any private API.
So if I haven't dissuaded you, it's in a public repo on github…
https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSBundle+MainApp.h
https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSBundle+MainApp.m
_______________________________________________
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