Swift和Cocoapods-缺少必需的模块 [英] Swift and Cocoapods - Missing required module

查看:116
本文介绍了Swift和Cocoapods-缺少必需的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个Swift框架。该框架取决于两个库,,并尝试了一些操作(更改构建设置,将库添加到链接库,添加桥接头文件(尽管我没有处理ObjC))没有任何效果。



有人对如何解决此问题有任何想法吗?



编辑:我正在使用Cocoapods v0.37.0.beta.1。与v0.36.4相同的问题。

解决方案

将Xcode更新到版本6.3.1后,问题已解决。


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.

解决方案

Problem solved after updating Xcode to version 6.3.1.

这篇关于Swift和Cocoapods-缺少必需的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆