Swift and Cocoapods - Missing required module

半城伤御伤魂 提交于 2020-01-02 07:29:12

问题


I am trying to make a Swift framework. This framework depends on two libraries, Alamofire and SwiftyJSON, which are both written in Swift.

I am using CocoaPods to import these libraries in my framework. Here is the content of my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '1.2'
pod 'SwiftyJSON', '2.2'

In my framework, I have a class that imports and uses these two modules:

import Alamofire
import SwiftyJSON

I can run pod install and build my framework successfully!

Now things get tricky when I'm trying to use my framework in a Swift project.

  1. I copy the .framework file into my project.
  2. In the Build Phases of my project's target, I add a Copy Files Phase with "Destination" set to "Frameworks", and add my framework file.

  1. I import my framework in a Swift class of my project:

    import MyFramework
    

The problem is: Xcode keeps telling me

Missing required module 'SwiftyJSON'

And more surprising: if I don't use SwiftyJSON and remove it from my framework (but still use Alamofire)... It works! And I have the same problem with any other lib than SwiftyJSON. Only Alamofire seems to work.

I've already seen some issues, like this one, and tried some things (changing Build Settings, adding the libraries to the Linked Libraries, adding a Bridging Header though I'm not dealing with ObjC) with no effect...

Does anyone have any ideas on how to solve this problem? It's driving me nuts!

EDIT: I'm using Cocoapods v0.37.0.beta.1. Same issue with v0.36.4.


回答1:


Problem solved after updating Xcode to version 6.3.1.



来源:https://stackoverflow.com/questions/29829641/swift-and-cocoapods-missing-required-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!