Missing required module 'MLKit' error while using a framework that uses MLKit

Viewed 1524

Recently I created a iOS Framework called "MLKit Framework" that uses MLKit Face Detection library. In order to achieve that, I just imported the library in Podfile according to documentation.

As expected, that created a xcworkspace called MLKit Framework. In order to test that new framework, I created an app called MLKitApp and added that app to the same workspace. Then I added the framework MLKitFramework to that app and tried to build it but I get the error statement: "Missing required module 'MLKit'" as the image below.

Error statement: Missing required module 'MLKit'

Why Am I getting that error? What I'm doing wrong?

Reproducible Example

I created a Reproducible Example here. In order to execute that example execute the following:

  1. Execute pod install for MLKitFramework;
  2. Add MLKitApp to MLKitFramework.xcworkspace;
  3. Add MLKitFramework.framework as a MLKitApp Frameworks, Libraries and Embedded Content;
  4. Try to build MLKitApp.

And voilĂ 

2 Answers

You can't do this because your's "MLKitFramework" have dependency to MLKit.

You should add MLKit framework to MLKitApp additionally.

Have you checked out the ML Kit Vision Quickstart? Please note it contains two apps: one for swift and another for objective-c. You check check out the swift app for your purpose - it contains face detection feature. The Vision Quickstart is similar to your MLKitApp and shows you an example how to integrate with ML Kit cocoapods directly without needing to introduce an "MLKitFramework" or manually manage dependency configuration. Instead, you should let CocoaPods manage that. You can use this Quickstart as a template for implementing your own app.

Related