• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is App in Resources App Bundle Evil?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is App in Resources App Bundle Evil?


  • Subject: Re: Is App in Resources App Bundle Evil?
  • From: kalexm <email@hidden>
  • Date: Tue, 16 Nov 2010 19:25:48 +0100

Am 15.11.2010 um 04:43 schrieb Kyle Sluder:

> On Sun, Nov 14, 2010 at 9:55 AM, kalexm <email@hidden> wrote:
> Hello all,
>
> I'm new to the list and somewhat new to OSX (not iphone!) development. I spent ten years most of my time in java so it was a hurdle..
>
> I am currently developing an app (APP-A) which does PDF manipulation. I have a second app (APP-B), that provides a PDF Viewer which is older.
> APP-A depends on APP-B as it uses APP-B for viewing manipulated PDFs. APP-B is independent from APP-A.
> I could put both apps into Applications. But if a User don't know what APP-B is for as he might only wan't APP-A but didn't see the dependency, he might delete APP-B and APP-A cannot work properly anymore.
>
> To solve this I put APP-B into the resources of APP-A, and it works to launch the app from this directory. I have not found any documentation from apple or mailing-lists if this is unwanted, problematic or somewhat evil!? The launchd finds the 'hidden' APP-B and behaves as expected...
>
> Is this allowed and recommendable, or how could I solve this alternatively and I don't want to merge the apps!?
>
> The code signing in-depth technote (TN2206) advises against using Resources for this. It suggests putting the helper app bundles in the Contents folder, and single-file helper binaries directly inside Contents/MacOS. http://developer.apple.com/library/mac/#technotes/tn2007/tn2206.html#TNTAG19
>
> --Kyle Sluder

Sorry, I forgot 'reply-all'

Yeah that was the source I was looking for. I've inserted a copy build phase. I managed to put APP-B everywhere but not directly under Contents. I do it now by a shellscript that I run after building. But this could'nt be the final solution...

I put together some code, but it crashes. As I couldn't simply attach the debugger (as the bash needs to copy it in the right position..) debugging is complicated...


	CFURLRef appURL;
	CFBundleRef bundle = CFBundleGetMainBundle();
	NSString *app = @"B.app";
	appURL = CFBundleCopyAuxiliaryExecutableURL(bundle,(CFStringRef)app);
	if (appURL != NULL) {
		FSRef applicationRef;
		CFURLGetFSRef(appURL, &applicationRef);
		FSRef fileRef;
		CFURLGetFSRef(pDFDocumentURL, &fileRef);
		LSLaunchFSRefSpec   launchSpec = { &applicationRef, 1, &fileRef, NULL, kLSLaunchDefaults, NULL };
		OSStatus err = LSOpenFromRefSpec(&launchSpec, NULL);
		if (err != kLSApplicationNotFoundErr) {
			//do something...
		}
	}
	CFRelease(appURL);

best,_______________________________________________

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

References: 
 >Is App in Resources App Bundle Evil? (From: kalexm <email@hidden>)
 >Re: Is App in Resources App Bundle Evil? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Garbage Collection, Standard Out, NSTask
  • Next by Date: Re: Garbage Collection, Standard Out, NSTask
  • Previous by thread: Re: Is App in Resources App Bundle Evil?
  • Next by thread: Releasing static variable & concurrent data protection questions...
  • Index(es):
    • Date
    • Thread