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.
Related
I have created a framework project in Xcode -that has dependency on some pods- to be able to use in different Xcode projects.
How can Xcode be informed to get that framework the dependency it needs?
You have to declare the dependencies on frameworks or on other pods in the podspec file. This file will explain to cocoapods how to correctly bind the pod in your XCode project.
You have an example at the end of the second sample in this page.
I have successfully integrated unity generated Xcode project in my existing Xcode project.
My existing Xcode project has lot of pods installed and I also have custom config file “debug.xcconfig” set in "Project->Info-Configuratios->Debug settings".
When I install pods with pod install command it come up with this warning.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target ProjectName to Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig or include the Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig in your build configuration (../debug.xcconfig).
Although pods get installed successfully.
As the above warning suggest I included “Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig” to top of my custom config file i.e “debug.xcconfig”.
Project is get compiled successfully. Now issues is arise when I used any of installed pods in my existing project with below errors.
“Cannot find protocol declaration for 'GIDSignInDelegate’”
“Cannot find protocol declaration for 'ARSessionDelegate’” etc.
Any help would be appreciated!
Finally i resolved the issues just by importing above mentioned Pods in my objectiveC bridging header file.
'Just like #import'
import <GoogleSignIn/GoogleSignIn.h>
import <ARkit/ARkit.h>
Here is my situation:
I am using CocoaPods but I can't use the "use_frameworks!" directive as it is not compatible with ReactNative
I need to include another team's SDK, distributed as a .framework
This .framework depends on PureLayout, which is available through Pods
Hence:
I installed PureLayout through Pods.
I manually linked the other team's SDK dragging it into Embedded Binaries, as per their instructions
Build fails with error Module 'PureLayout' not found. It seems that the other team's framework isn't able to find the PureLayout module included through Pods.
How can I fix? Remember I can't use_frameworks! in Podfile. Thanks.
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?
I am trying to import and use the OAuthSwift library in the Swift iOS project. I followed their directions:
Drag OAuthSwift.xcodeproj to your project in the Project Navigator.
Select your project and then your app target. Open the Build Phases panel.
Expand the Target Dependencies group, and add OAuthSwift framework.
import OAuthSwift whenever you want to use OAuthSwift.
After completing these steps, importing OAuthSwift using import OAuthSwift causes the error No such module 'OAuthSwift' and the project fails to build.
I have tried the following steps, based on a number of other SO questions about similar issues:
Clean and rebuild
Add the OAuthSwift framework to many different combinations of Build Phases > Target Dependencies, Build Phases > Link Binary With Libraries, Build Phases > Embed Frameworks, and General > Embedded Libraries
Set Build Settings > Search Paths > Framework Search Paths and Build Settings > Search Paths > Library Search Paths to $(SRCROOT) and recursive.
Verify that my deployment target matches the deployment target of the OAuthSwift Xcode project.
I have tested this using the latest version of OAuthSwift from their master branch using a git submodule, as well as manually downloading and importing each of the two latest tagged versions (0.6.0 and 0.5.2).
I have also created a brand new Xcode project, imported OAuthSwift as above, and encountered the same error.
Finally, I also tried importing a different Swift Framework (Alamofire), following the steps as stated on the README at https://github.com/Alamofire/Alamofire. This caused the same error as well: No such module 'Alamofire'.
I am using:
OSX 10.11.6
Xcode 7.3.1
Swift 2.2
I'm still fairly new to Xcode and the Swift module system, so any help or suggestions is appreciated.
Your life will be a lot easier if you import the framework using CocoaPods. If you haven't used them before, it's really easy once you get set-up. You use Ruby Gems on the command line to install CocoaPods (sudo gem install cocoapods) and then create a create a pod file using pod init. After this you modify it to include:
platform :ios, '8.0'
use_frameworks!
pod 'OAuthSwift', '~> 0.5.0'
Save the file and run pod install.
Once this is complete you will have to close out the Xcode project and use the newly created .xcworkspace project file (not the .xcodeproj) from here forward.
Here is a link to another post for a secondary reference.
How to install cocoapods?