I have an iOS project written purely in Swift which uses CocoaPods for dependency management. In my Podfile I have the "use_frameworks!" keyword to inform CocoaPods that I want my dependencies as Swift dynamic frameworks.
Trying to integrate the Restcomm iOS SDK (which is written in ObjC) into my project, I have run into the following issue:
After adding the pod to my podfile and doing a "pod install", the workspace is updated and the pod is installed just fine. Although, the build fails with an error: Lexical or preprocessor issue: sofia-sip/sdp.h file not found. The sofia-sip-library is a dependency of the restcomm-ios-sdk itself.
For reference, I also created a new iOS project, now in ObjC, and installed the restcomm-ios-sdk without using frameworks. After that, the build runs just fine.
Seems like the issue is related to my project being in Swift and using dynamic frameworks, while the restcomm sdk is a static ObjC library.
I have tried to modify the Target / Build Settings / Header Search Paths, but it turns out using dynamic frameworks leaves my Pods/Headers folder empty.
Others have run into similar issues before:
https://github.com/CocoaPods/CocoaPods/issues/5330, https://github.com/CocoaPods/CocoaPods/issues/4605, https://github.com/CocoaPods/CocoaPods/issues/3839
Although, none of these threads offer a solution that would work for me. Any idea how I could go about solving the issue?
Related
I have an Xcode project, consisting of a swift packages, a custom cocoa pods and one target dependency.
In workspace I have:
Project ProfileUtil - xcode project of type Framework. This project contains Firebase SPM dependencies
Project DatabaseUtil - xcode project of type cocoapod. This project contains Firebase pods dependencies
Project MeditationApp - Xcode project of type iOS Application. This is the main application, and it should include ProfileUtil as a framework swift packages, and DatabaseUtil as a Pod
When I try to compile the main iOS application, Im seeing errors like:
Error: Redefinition of module 'Firebase'
module Firebase {
export *
header "Firebase.h"
}
So that got me wondering if I can mix both SPM and Cocoapods in the same project if both uses the same library internally? (I couldn't find any useful ressources online about that use case, which surprise me)
Is there a bypass I could do to fix those, because as in the moment I have to keep my custom pod DatabaseUtil as a cocoapods.
Nope. Firebase does not support being installed from both CocoaPods and Swift Package Manager in the same project. It might be possible to hack into place by hacking the workspace after a CocoaPods install, but it would be fragile.
In order to implement Mapbox SDK, according to official docs (https://docs.mapbox.com/ios/maps/overview/#install-the-maps-sdk,
https://docs.mapbox.com/ios/navigation/overview/), adding Mapbox-iOS-SDK and MapboxNavigation through Cocoapods, always get error, shown bellow.
I thought this is related to the usage of sourcery or SwiftGen which are the parts of project or something else, but this happened on new, clean project also, where inserting SDKs was the first step.
Cleaned derived data for few times,
remove from Podfile versioning for that SDK (pod 'Mapbox-iOS-SDK', '~> 6.0.0' as pod 'Mapbox-iOS-SDK' )
even when SDK is added through CocoaPods, can't find frameworks to add into Link Binary With Libraries
even it says Copy Bundle Resources to be checked, couldn't find what to expect there
Note:
Also tried: successfully added Mapbox and MapboxMobileEvents directly into project, but as I found MapboxNavigation SDK could be implemented only through CocoaPods or Carthage, so I'm stuck here.
I would really appreciate for someone's help, who already have faced this problem.
Multiple commands produce '/Users/x/Library/Developer/Xcode/DerivedData/mbNavigationExample-ctztmwiegsuqkigkucoydhnnoaxc/Build/Products/Debug-iphoneos/mbNavigationExample.app/Assets.car':
1) Target 'mbNavigationExample' (project 'mbNavigationExample') has compile command with input '/Users/x/Desktop/mbNavigationExample/mbNavigationExample/Assets.xcassets'
2) That command depends on command in Target 'mbNavigationExample' (project 'mbNavigationExample'): script phase “[CP] Copy Pods Resources”
I am trying to install a Pod in my IOS/iPhone project using Xcode 9.3.1.
My target app is configured to use Swift 3.3.
After adding the following line to my podfile...
pod 'Concorde'
I ran...
pod install
The pod installed normally. However, upon compilation, I receive a mess of compiler warnings and errors like "NSUrlResponse was obsoleted in Swift 3". It seems the Swift version I have (3.3) is too new.
The Swift version configured for the build target is also 3.3.
It looks like an older Swift is required for this Pod. However, is there a simple way to determine which Swift version is required for the pod?
I checked the CocoaPods.org web site and the page does not show the Swift version required for the library.
I also checked the podspec, where I expected to find that version number requirement.
You can try terminal command,
pod try "pod name"
this will clone the repo automatically for you to test the framework on the fly
there you can check out whatever you need.
Plus reading the description on GitHub helps too
Also i recommend using highly popular pods, as they tempt to be more stable.
read the reviews about the framework, and try to find other alternatives for it.
New update: You can try to preview .podspec file inside the Repo on github sometimes you can find the Swift Version of that Pod example : here
I have a Cocoa Touch framework file which I take out regularly from my codebase. It has some helper classes which I uses in some of my projects. It was doing good before the evolution of Xcode 9.0.
When I tried that framework in a project of Xcode 9 then it shows error that the module is compiled with Swift 3.1 so I compiled the whole classes using Swift 4 and tried to use that in a application, it still shows me the above mentioned error.
If I use the same project in Xcode 8.3.2 then it works well.
If the issue is in one of external libraries then their recompilation is required. For that one way is:
Deintegrate all the pods first:
pod deintegrate
Run pod install again:
pod install
Also, clean XCode Derived Data & clean up your project.
I've been using use_frameworks! directive so that I can use some dependencies on my project. If I comment that directive, I get a red message saying
Pods written in Swift can only be integrated as frameworks; this feature is beta. Add 'use_frameworks!' to your Podfile or target to opt into using it.
Today I decided to use Google Analytics for iOS but when running $pod install I get
The 'Pods-MyProject' target has transitive dependencies that include static binaries
Googling around I found out it is caused because of the use_frameworks! directive and I should remove it. So I'm between a wall and a sword, what can I do to be able to work with these libraries?
PS: We are required to manage dependencies using Cocoapods, so including it in a different way is not an option. Also, I don't have a bridging header in my project, but I'm still able to work with libraries using import MyDependency