Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

include of non-modular header JSQSystemSoungPlayer error #1497

Closed
marcioarantes-ww opened this issue Mar 10, 2016 · 24 comments
Closed

include of non-modular header JSQSystemSoungPlayer error #1497

marcioarantes-ww opened this issue Mar 10, 2016 · 24 comments
Assignees
Labels
Milestone

Comments

@marcioarantes-ww
Copy link

I want to use JSQMessagesViewController as a dependency to my swift pod. When I build my example app I get the old non-modular header error related to the JSQSystemSoundPlayer but I don't know how to get around it with XCode 7.

Podspec:
s.dependency 'JSQSystemSoundPlayer'
s.dependency 'JSQMessagesViewController', '7.2.0'
#Also tried 5.3.2

screen shot 2016-03-10 at 12 16 07 pm

screen shot 2016-03-10 at 12 09 38 pm

@Mackarous
Copy link

Hi @marcioarantes-ww

I have actually had similar experiences with this problem. The issue is that Swift doesn't play nice with importing non-modular frameworks into frameworks. Essentially, you will only run into this problem when bundling a framework inside another. There is a simple solution, however it requires some work JSQSystemSoundPlayer as well as JSQMessagesViewController.

@jessesquires Both projects (JSQSystemSoundPlayer as well as JSQMessagesViewController) will need to have the following Xcode project setting: DEFINES_MODULE = YES; Should I put two PRs through?

@jessesquires
Copy link
Owner

@Mackarous 👍 👍 👍 👍

@jessesquires
Copy link
Owner

Related: #927, #1283, #1284, #1060

@marcioarantes-ww
Copy link
Author

Thank you guys! :)

@Mackarous
Copy link

Hey sorry for the delay,

@jessesquires:

Upon further investigation, it turns out that JSQSystemSoundPlayer is not an issue, and can remain as is. The change that needs to be done is in the JSQMessagesViewController Podfile. The Podfile requires the following changes:

platform :ios, '8.0'
use_frameworks!

This will use frameworks instead of static libraries for the included projects, which in the case of JSQMessagesViewController is only JSQSystemSoundPlayer. This will allow the import of JSQSystemSoundPlayer as a module, and it should resolve the errors that @marcioarantes-ww is having. I have only been able to test in a very controlled environment as I do not know the exact intricacies of @marcioarantes-ww's project.

Summary of changes to JSQMessagesViewController:

  • Change Podfile platform to iOS 8
  • Change Podfile to use frameworks instead of static libraries
  • Change project structure deployment target to iOS 8
  • Run pod install

@jessesquires jessesquires modified the milestones: 8.0.0, 7.2.1 Mar 19, 2016
@jessesquires
Copy link
Owner

Thanks for the investigation and info @Mackarous ! Huge help! 🙇

This was what I expected to hear. We'll have to target this change for version 8.0 of the library.

@marcioarantes-ww
Copy link
Author

I believe this is incorrect. As stated above JSQMessagesViewController works fine with the use of use_frameworks! flag in the podfile but this is not what I'm doing. JSQMessagesViewController is a dependency of my own pod not a project. I was able to compile my example app by updating JSQSystemSoundPlayer+JSQMessages to include @import JSQSystemSoundPlayer; @Mackarous @jessesquires

@Mackarous
Copy link

Hey @marcioarantes-ww,

I should have elaborated further:

The reason this works is because you are importing JSQMessagesViewController as a dependency in your project. Making the change you suggested is specific to your project, and will actually break when using JSQMessagesViewController through a Podfile. The reason for that is because you are using frameworks in your Podfile which takes precedence, and since you are using JSQMessagesViewController as a dependency in a Podspec, it follows your Podfile's use_frameworks! tag. Finally, changing a file in your dependency is temporary since running a pod update or pod install will overwrite your changes.

To ensure that JSQMessagesViewController works as a pod in a project Podfile and a dependency in a Podspec, the changes I outlined above need to be implemented.

@marcioarantes-ww
Copy link
Author

@Mackarous got it thanks for clarifying. Looking forward to your next update.

@jessesquires
Copy link
Owner

Thanks @Mackarous ! 🎉 😄

@edwardvalentini
Copy link

+1 for this issue :)

@jessesquires jessesquires self-assigned this Apr 5, 2016
@chrisscholly
Copy link

I have this issue and can't resolve it... :(

  • JSQMessagesViewController 7.2.0
  • cocoapods 1.0.0.beta.6

capture d ecran 2016-04-08 a 14 00 38

@chrisscholly
Copy link

finally works with cocoapods 0.39.0. Do not use beta :p

@Nathan187
Copy link

I'm still getting this error. how exactly did you fix it? this is what my podfile looks like

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

target 'EODPOC' do

pod 'Alamofire'
pod 'Facebook-iOS-SDK', '~> 3.23.0', :inhibit_warnings => true
pod 'MMDrawerController' , '~> 0.5.7'
pod 'MMProgressHUD', :inhibit_warnings => true
pod 'MagicalRecord', :inhibit_warnings => true, :inhibit_warnings => true, :git => 'https://github.com/magicalpanda/MagicalRecord.git', :branch => 'release/3.0'

#pod 'FMDB'
pod 'FMDB', :git => 'https://github.com/robertmryan/fmdb.git'

pod 'RNCryptor', :inhibit_warnings => true
pod 'SwiftyJSON'

pod 'JSQMessagesViewController'
#pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'

end

@edwardvalentini
Copy link

is your project structure also using ios 8.0 as the minimum deployment target? When i followed @Mackarous instructions the first time, i had a mismatch and got an error.. but if both the podfile and project are set to 8.0 then it worked

@Nathan187
Copy link

thanks for the rapid reply (no sarcasm). i tried changing it to 8.0, 9.0, 9.2, etc. I changed the deployment target and platform values to match but still get the error. this was working previously but just no longer compiles

@jpsachse
Copy link

jpsachse commented May 4, 2016

+1 on the "JSQSystemSoundPlayer/JSQSystemSoundplayer.h file not found" error using cocoapods 1.0.0.rc1.

EDIT: seems to work for RC2 Works only, when built for a device plugged in, but still results in JSQSystemSoundPlayer.h not found for the simulator.

@chrisballinger
Copy link
Collaborator

Encountered this with CocoaPods 1.0.0. You need to @import JSQSystemSoundPlayer;

@jpsachse
Copy link

It seems to work for me (for now) using Swift 2.2 with Xcode 7.3.1 and CocoaPods 1.0. It currently builds both in simulator and on device just using import JSQMessagesViewController

@jerembab
Copy link

It work for me ( using Swift 2.2 with Xcode 7.3.1 and CocoaPods 1.0 ) but only in simulator , in device Im getting the following errors: 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/.../Frameworks/JSQMessagesViewController.framework> (loaded)' with name 'JSQMessagesViewController'
any ideas?

@jessesquires
Copy link
Owner

Fixed by #1649

@thuanngo1990
Copy link

I still got same issue (using swift 2.2 , xcode 7.3.1 and cocoaPods 1.0), it work only in simulator. In my devide (iphone 6 , ver 9.3.2). My pods file also change to "platform :ios, '8.0'
use_frameworks! " @Mackarous . It still happening. This's message :

  • 'JSQSystemSoundPlayer/JSQSystemSoundPlayer.h' file not found.
  • Could not build Objective-C module 'JSQMessagesViewController'.
    Anything i can do?

@jessesquires
Copy link
Owner

The fix is on develop and will be included with v8.0 of the library

@aaso
Copy link

aaso commented Jun 16, 2017

it was working perfectly but when i update my pod file and reinstall, i got same issue (using swift 3.1 , xcode 8.3 and cocoaPods 1.0),
platform :ios, "9.0"
use_frameworks!

'JSQSystemSoundPlayer/JSQSystemSoundPlayer.h' file not found.
Could not build Objective-C module 'JSQMessagesViewController'.
Anything i can do? @jessesquires

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests