Accessing a shared Bundle?

Hi,


I want to add an Photos Extension to an existing app but don't want to double my resources.

Is there any way not to have every resource twice once in my .app bundle and once in my .appex bundle?


I apprechiate any trick (so far none have worked.


All the best

Christoph

I never tried this, so I do not know if it will work but you could try from the extension to do this:



NSBundle *mainAppBundle = [NSBundle bundleWithIdentifier:@"BUNDLE_ID_OF_MAINAPP_HERE"]
NSImage *image = [mainAppBundle imageForResource:@"IMAGE_NAME_HERE"];


You can also try:


NSURL *URL = [[NSWorkspace sharedWorkspace]URLForApplicationWithBundleIdentifier:@"BUNDLE_ID_OF_MAINAPP_HERE"];
NSBundle *mainAppBundle = [NSBundle bundleWithURL:URL];
 NSImage *image = [mainAppBundle imageForResource:@"IMAGE_NAME_HERE"];


Again, I don't know if this will work; the extension may not have permissions to access resources in your main app. You can try though.

Accessing a shared Bundle?
 
 
Q