How to use third-party lib in iOS built-in dynamic framework with fast

Now I have a project, for example testApp, using some third-party libs like alamofire and some other libs in objective-c.

Now I want to add a widget today. According to some tutorial, I created a new target "testAppKit" as a common dynamic structure and a target "testAppWidget" as today's extension. The common code will be in testAppKit for reuse.

Now I need to use third-party libraries in testAppKit. And added lib and header in the testAppKit build phases. Then I add #import <theLib/TheHeader.h> to testAppKit.h. But there is an error:

 Include of non-modular header inside framework module 'testAppKit' 

So, I want to know how to use third-party libraries (possibly in Swift or Objective-C) in such an integrated dynamic structure.

+5
source share
1 answer

I use the Dropbox Datastore API in my application, and I finally made it work for Cocoa's built-in touch framework to share code for the Containing Application and Today Extension.

I realized that in my Swift file in the inline structure, I can import any third-party structure that I had in the project (e.g. Farbic.framework, Crashlytics, etc.), but not Dropbox.

What is the difference? Folder "Modules"! Dropbox.framework does not provide a module map file. So I created it based on what I found in Fabric.framework:

  • Go to the Dropbox.framework folder in your directcotry project.
  • Create a new folder "Modules" and go inside
  • Create a file named: "module.modulemap"

File contents:

 framework module Dropbox { umbrella header "Dropbox.h" export * module * { export * } } 

After that I needed to add an import path.

  • Go to the project file
  • Choose the goal of embedded infrastructure
  • Go to "Build Settings" and find "Quick Compiler - Search Paths"
  • Add the path to your Dropbox.framerowk and set the "recursive" option.

I wanted to put a screenshot here, but I can not do it - because of my "reputation";)

Now I can do "import Dropbox" in my fast files :)

Hope this can help you :)

+7
source

Source: https://habr.com/ru/post/1207185/


All Articles