You can pull this off by specifying the direct path to the extension's bundle. It looks like app extensions live in the PlugIns/
folder in your app's main bundle. You can create an instance of NSBundle
by using -initWithPath:
. For example:
- (NSBundle *)appExtensionBundle {
NSString *plugInsPath = [NSBundle mainBundle].builtInPlugInsPath;
NSString *appExtensionPath = [plugInsPath stringByAppendingPathComponent:@"MyTodayExtension.appex"];
return [[NSBundle alloc] initWithPath:appExtensionPath];
}
NOTE: This code was tested only with a Today extension. You should test to make sure it works correctly if you have other types of extensions.