Getting error “No such module” using Xcode, but the framework is there

前端 未结 30 1895
小蘑菇
小蘑菇 2020-11-22 05:02

I\'m currently coding in Swift, and I\'ve got an error:

No such module Social

But I don\'t understand, because the module is in

30条回答
  •  旧时难觅i
    2020-11-22 05:52

    I also encountered the same error a few days back. Here's how I resolved the problem:

    The error is "module not found"

    • Create Podfile in your root project directory
    • Install cocoapods (a dependency manager for Swift and iOS projects)
    • Run pod install
    • Go to Project Build Settings:

      • Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
      • Drag and drop the library header file from left side to bridging header (see image attached)
    • Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)

    • In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
    • In your Swift file the code should be: Import Mixpanel (i.e name of library)

    That's all.

提交回复
热议问题