Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import JSQMessagesViewController in swift?

I am working with xcode 6.3, swift 1.2 and I install the "JSQMessagesViewController" library with cocoapods. Here is my pod file:

pod 'JSQMessagesViewController'

and my bridge file:

#import <JSQMessagesViewController/JSQMessages.h>

then I get the error:

'JSQMessagesViewController/JSQMessages.h' file not found with <angled> include; use "quotes" instead

I don't know why it goes wrong. When I update the bridge file with

 #import "JSQMessagesViewController/JSQMessages.h"

I get the error

JSQMessagesViewController/JSQSystemSoundPlayer+JSQMessages.h:19:9: 'JSQSystemSoundPlayer/JSQSystemSoundPlayer.h' file not found with <angled> include; use "quotes" instead

This really gets me confused because the error is in the source code of JSQMessagesViewController which I cannot modify. I have googled for one day and get no methods to fix it. Since the JSQMessagesViewController library is so popular in githup, I believe the there must be someone know how to fix it.

like image 651
jerry_sjtu Avatar asked Dec 20 '22 05:12

jerry_sjtu


2 Answers

You used the notation for a framework. Are you using cocoapods 0.36 or later? Then you could make a framework from JSQMessagesViewController by putting this in your pod file:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'JSQMessagesViewController'
like image 91
Edwin Vermeer Avatar answered Dec 24 '22 02:12

Edwin Vermeer


I ran into this issue and I was using Xcode7, swift 2, iOS 9, using cocoapods version 0.38.2 and what solved it for me was removing the declaration of #import <JSQMessagesViewController/JSQMessages.h> from the Bridging-Header.h file.

Then import it to the class you want to use it in.

 import UIKit
 import JSQMessagesViewController

 class MessageViewController: JSQMessagesViewController {

 }

As of Cocoapods 0.36 if you put use use_frameworks! into the Podfile (like Eric D said, then cocoapods will create a framework of any Pod that you include.

like image 23
bolnad Avatar answered Dec 24 '22 00:12

bolnad