5

I have two Xcode 11.3.1 projects for iOS 13.2:

  • MyFramework: for generating a framework from Swift and Objective-C source files of mine. This source code uses OpenSSL framework, which is embedded in MyFramework using "Embed & Sign" option, so MyFramework is a framework that has a nested framework (OpenSSL).
  • TestApp: a swift application that imports MyFramework (and doesn't need OpenSSL functionality).

When I compile MyFramework, the following directory is created in MyFramework Products directory (Xcode correctly includes OpenSSL submodule inside MyFramework):

MyFramework.framework/Frameworks/OpenSSL.framework

Curiously, Modules and Headers directories are missing in "OpenSSL.framework" (have not been copied from the original OpenSSL.framework), but this seems good to me because I don't want to use OpenSSL functionality directly in my TestApp.

However, when I add MyFramework to TestApp and try to compile it, I get the error "Missing required module 'OpenSSL'" in the swift file where the line "import MyFramework" is. This means MyFramework has been correcty found but OpenSSL hasn't.

If I manually add the file MyFramework.framework/Frameworks/OpenSSL.framework/Modules/module.modulemap with the following content (no headers, no exports), then the problem is gone:

framework module OpenSSL {}

Is there a better solution? Why are "Modules" and "Headers" directories not copied? Why is OpenSSL needed in TestApp at compilation time?

Additional note (06-09-2020): I forgot to mention an important detail. TestApp is able to find OpenSSL framework because I manually added the following path to "Framework Search Paths" in TestApp build setings: $(PROJECT_DIR)/Frameworks/MyFramework.framework/Frameworks

This puzzles me. If a framework has nested frameworks, why are they not included automatically in searching paths?

I found these questions related to umbrella frameworks in iOS:

Could MyFramework be considered an umbrella framework and Xcode is not fully prepared for such cases?

M. Quijada
  • 63
  • 6

0 Answers0