Mergeable Library Bundle Hooking Does Not Work When Frameworks Is Merged Into Container Framework

Problem

When we merge FeatureModuleA.framework into IntegrationContainer.framework instead of HostApp_Main.app, the magic method Bundle(for: FeatureAProvider.self) does not work and this will trigger crash.

When FeatureModuleA is merged into HostApp, Bundle(for: FeatureAProvider.self) will return:

  • HostApp_Main.App/Frameworks/DomainFeatureA.framework
  • instead of HostApp_Main.App/,

although the FeatureAProvider class is actually in the merged main app binary So we can use the returned FeatureModuleA bundle get the nested resource.

If we merge the frameworks into our IntegrationContainer.framework, the result will be:

  • for release: PrototypeApp.app
  • for debug: PrototypeApp.app/Frameworks/IntegrationContainer.framework/ReexportedBinaries/DomainFeatureA.framework

Apple has not considered the case that frameworks are merged into independent framework.

And other methods like bundle(for: identifier) does not work for both destination cases: merge into main app or a container framework.

Mergeable Library Bundle Hooking Does Not Work When Frameworks Is Merged Into Container Framework
 
 
Q