如何在swift中导入JSQMessagesViewController?
我正在使用xcode 6.3,swift 1.2,我用cocoapods安装了“JSQMessagesViewController”库。 这是我的pod文件:
pod 'JSQMessagesViewController'
和我的桥文件:
#import <JSQMessagesViewController/JSQMessages.h>
那么我得到的错误:
'JSQMessagesViewController/JSQMessages.h' file not found with <angled> include; use "quotes" instead
我不知道为什么会出错。 当我更新桥文件
#import "JSQMessagesViewController/JSQMessages.h"
我得到错误
JSQMessagesViewController/JSQSystemSoundPlayer+JSQMessages.h:19:9: 'JSQSystemSoundPlayer/JSQSystemSoundPlayer.h' file not found with <angled> include; use "quotes" instead
这真的让我感到困惑,因为错误是在我无法修改的JSQMessagesViewController的源代码中。 我GOOGLE了一天,没有办法解决这个问题。 由于JSQMessagesViewController库在githup中非常stream行,我相信必须有人知道如何解决这个问题。
您使用了符号框架。 你使用椰子树0.36或更高版本? 然后你可以通过把这个放在你的pod文件中来从JSQMessagesViewController中创build一个框架:
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! pod 'JSQMessagesViewController'
我遇到了这个问题,我正在使用Xcode7,Swift 2,iOS 9,使用cocoapods 0.38.2版本,并解决了这个问题是从Bridging-Header.h
删除#import <JSQMessagesViewController/JSQMessages.h>
的声明文件。
然后将其导入到您要使用它的类中。
import UIKit import JSQMessagesViewController class MessageViewController: JSQMessagesViewController { }
至于Cocoapods 0.36,如果你使用use_frameworks! 进入Podfile(就像Eric D说的那样,那么cocoapods就会创build一个你包含的任何Pod的框架。
这应该工作:
#import "JSQMessages.h" #import "JSQMessageData.h"
从这个Swift回购的例子。
对我来说,它使用这个Podfile:
source 'https://github.com/CocoaPods/Specs.git' use_frameworks! pod 'JSQMessagesViewController'
并创build桥头。
(iOS 9,xCode 7,cocoapods 0.39.0)