podspec JSQMessagesViewController non-modular header - swift

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
Errors:

This is a known issue with v7.2.0 of JSQMessagesViewController: https://github.com/jessesquires/JSQMessagesViewController/pull/1284
Check this pull-request: https://github.com/jessesquires/JSQMessagesViewController/pull/1284
Specifically, this comment from jessesquires (the author): https://github.com/jessesquires/JSQMessagesViewController/pull/1284#issuecomment-181132880
The fix will be part of v7.2.1 according to that thread.

It is not related to JSQSystemSoundPlayer.
Add this at the beginning of your Podfile:
platform :ios, '8.0'
use_frameworks!
So app will use frameworks instead of static libraries for the included projects.
Summary of changes to JSQMessagesViewController:
Change Podfile platform to iOS 8 (platform :ios, '8.0')
Change Podfile to use frameworks instead of static libraries (use_frameworks!)
Change project structure deployment target to iOS 8
Run pod install
Build & run the app

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. Both projects will need to have the following Xcode project setting: DEFINES_MODULE = YES.

Related

Firebase Cocoapods - Error message; Could not build Objective-C module 'Firebase

I'm trying to import Firebase after installing Cocoapods via terminal but i'm getting the following error message:
Could not build Objective-C module 'Firebase
Can someone help me out with this?
This is my Podfile content:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Login_test' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Login_test
pod 'Firebase/Core'
end
Assuming that you have installed FireBase properly via CocoaPods. Try the following steps
Step 1 - Close Xcode
Step 2 - Clear your derived data. You can find your derived data in here
~/Library/Developer/Xcode/DerivedData
Step 3 - Open your .xcworkspace
Step 4 - Clean your project (⌘+Shift+K)
Step 5 - Build your project (⌘+B)
Hope this helps.
for beginners:
make sure you read the message after installing the Pod,
you need to close the xcode project and use the .xcworkspace for this project from now on.
For me the issue was simple. I have a new m1 mac and it has trouble loading cocoa pods sometimes. Simply click your pods project(blue pods)->Click all & build settings ->Excluded architectures -> add "arm64" to both debug and release -> set any SDK on left side -> do this on your main project folder too -> build it your good to go
See Example

Realm with Swift Error

I just created a new project and download and integrated the CocoaPods "RealmSwift". I get the following list of errors.
I have not added anything in my code. This is coming from Realm code. I am using Xcode 8 using Swift 3.0
Here is the Pod file:
If I say convert to Swift 3.0 then I get the following errors:
It seems the documentation for CocoaPods for RealmSwift may-be out of date when Xcode 8.1+ and Swift 3 is used. Step 3 is no more needed and you should skip it for this case.
i.e. you should now use (example):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'RealmProjectAzam' do
use_frameworks!
pod 'RealmSwift'
end
Edit - addition information:
Please note, after the above question has been posted, there was some additional discussion incl. Realm and the result is that Realm (thanks #realm!) has adjusted its Swift documentation to better face the above issue. Please see the updated instructions for Cocoapods installation at realm.io
In short, to "solve" the above issue please:
Run pod repo update to make CocoaPods aware of the latest available Realm versions.

An error during mapbox import

I'm currently following this tutorial:https://www.mapbox.com/help/first-steps-ios-sdk/ and It all works up until I should use the
import Mapbox
command. Then i get an error saying:
Could not build objective-C module 'Mapbox'.
I just follow the steps and even tried it using cocoapods.
I'm using Xcode 6.4 and faced the same problem. I suppose it's caused by a too old version of Swift compiler and some 'new' Swift language features used in the latest version of Mapbox iOS SDK.
So, I just sorted through older versions of Mapbox iOS SDK using CocoaPods. The latest release version which appeared to be compatible with my old Xcode is 3.1.0.
That's my Podfile:
platform :ios, "8.0"
inhibit_all_warnings!
use_frameworks!
target "%APP%" do
pod 'Mapbox-iOS-SDK', '= 3.1.0'
end
I hope this was helpful for someone.

Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

Yesterday I updated Xcode to Version 7.3 (7D175) and suddenly my apps is not building any more. My dead line is near and I can't build the apps :-(
I tried to change Build Settings to:
allow non-modular includes in framework modules = yes
enable modules = no
My pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
use_frameworks!
#Parse, Facebook, Twitter
pod 'Parse'
pod 'ParseUI'
pod 'ParseFacebookUtilsV4'
pod 'ParseTwitterUtils'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
installed cocoapods-0.39.0
Analyzing dependencies
Downloading dependencies
Using Bolts (1.6.0)
Using FBSDKCoreKit (4.10.1)
Using FBSDKLoginKit (4.10.1)
Using FBSDKShareKit (4.10.1)
Using Parse (1.13.0)
Using ParseFacebookUtilsV4 (1.11.1)
Using ParseTwitterUtils (1.10.0)
Using ParseUI (1.2.0)
What should I do to solve this issue?
I changed back app build settings to:
allow non-modular includes in framework modules = no
enable modules = yes
And I changed the Pods > ParseFacebookUtilsV4 as follow in the image below and everything is fine again. I hope that can help you too.
See the screen-shot
It worked for me!

Issue installing pod written in Swift with CocoaPods

I'm trying to import the XLPagerTabStrip podfile to my project but I keep getting the error of:
Analyzing dependencies
Downloading dependencies
Using Stripe (6.0.1)
Using XLPagerTabStrip (4.0.1)
[!] Pods written in Swift can only be integrated as frameworks;
add `use_frameworks!` to your Podfile or target to opt into using it.
The Swift Pod being used is: XLPagerTabStrip`
Could you help me fix this issue? Here is my podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
pod 'Stripe'
pod 'XLPagerTabStrip'
target 'Flokk' do
end
target 'FlokkTests' do
end
add use_frameworks! to the end of your Podfile like it tells you to