I try to build a WatchKit Extension for my app...
I Updated the pods file to look like this:
platform:ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
link_with 'my-team-ios', 'My Team WatchKit Extension'
def shared_pods
pod 'DOSingleton'
pod 'JSONModel'
pod 'MagicalRecord'
end
target :'My App' do
shared_pods
pod 'Facebook-iOS-SDK', '~> 3.23.1'
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
... some more pods here...
end
target :'My Team WatchKit Extension' do
shared_pods
end
How I install the pods and don't get an error...
But, when I build the App, I get this error:
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is my problem here?
I'm using Pod 1.2.1 and facing the same problem i.e. No such module XYZ and for anyone who came across the same issue here what I did to overcome it:
use_frameworks!
def shared_pods
pod 'XYZ'
end
target 'MyApp' do
platform :ios, '8.0'
shared_pods
pod 'Blah'
pod 'blah'
end
target 'Watch Extension' do
platform :watchos, '3.2'
shared_pods
end
I just added platform under each target e.g platform :watchos, '3.2' which was missing before and it solved my problem.
You need to open the xcworkspace file instead of the project file when using CocoaPods.
The problem is when updating to cocoapods 0.36.x they are now creating Frameworks out of each pod library. See the blog post about it.
This causes issues with any pod library that is dependent on other pods and how its referencing them in their import statements, or how your code is importing them as well. The Pod process now turns them into frameworks and when they used to be imported as
#import "ThisOtherPodClass.h"
Now need to be imported as
#import <ThisPodsFrameworkName/ThisOtherPodClass.h>
There is a new version of cocoa pods .38, that is designed to support WatchKit. However, if you want to work with the current version, check o make sure that libPods.a is added to the Target, WatchKit Extension in Included Libraries and Frameworks. Second, make sure that Pods.debug and Pods.release are added to Watchkit Extension in the General tabl
https://github.com/CocoaPods/CocoaPods/issues/3382
neonichu commented on Apr 15, 2015
would start by making sure OTHER_LDFLAGS isn't overwritten with unnecessary things, both in the project and the targets.
That set OTHER_LDFLAGS in buids settings solved my issus.
Try to change this lines
target :'My App', target :'My Team WatchKit Extension'
and remove colons:
target 'My App', target 'My Team WatchKit Extension'
I found a "temporally solution" for me:
Switch back to CocoaPods 0.35
Now everything is working fine, with our any changes to my project / pod file (except removing the 'use_frameworks!')
I think, that should not be the final solution here...
A short test by upgrading again to 0.36 raises the same problem as before...
Here is a link to the GitHub Issue:
Rename the target so it doesnt include any spaces -> MyTeamWatchKitExtension both in podfile and also in General -> Targets. This solved my problem
Related
I am using firebase for tracking crashes in my project and i am using the below pods in my project.
pod 'FirebaseCore', '6.6.4'
pod 'FirebaseMessaging', '4.3.0'
pod 'FirebaseAnalytics','6.3.1'
While archieving this project for placing the testflight build, i am getting duplication error below for google utilities :
Multiple commands produce '/Path/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-54e75ca4' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
When I checked my Pods settings in my build setting, I saw google utilities added twice in project. I have removed the one of the GoogleUtilities it's getting an error.
Note: I can able to run the build and I can't able to archive it. Is there any fix for achieving this build, without changing the legacy build system?
Because I have enabled the library distribution for my SDK, so when I made changes into legacy its throws an error.
Adding pod 'GoogleUtilities', '~> 7.7.0' to all the targets that use Firebase pods will make it work. In my case, this included 3 targets: iOS app, iMessage Extension and UnitTests.
No need to add this part explicitly:
def google_utilites
pod 'GoogleUtilities/AppDelegateSwizzler'
pod 'GoogleUtilities/Environment'
pod 'GoogleUtilities/Logger'
pod 'GoogleUtilities/MethodSwizzler'
pod 'GoogleUtilities/NSData+zlib'
pod 'GoogleUtilities/Network'
pod 'GoogleUtilities/Reachability'
pod 'GoogleUtilities/UserDefaults'
end
Update the Podfile to explicitly request all the needed GoogleUtilties subspecs. Examine the Podfile.lock to find the list.
There is a lot more detail at this CocoaPods issue.
This issue occurred to me when i added a new target to my project using very similar but not equal firebase dependencies, so GoogleUtilities was duplicated because my other target doesn't need as much dependencies from utilities as the main one so, basically (with the help of Paul Beusterien answer) went to the Pods project and look at both targets (GoogleUtilities-xxx) -> Build Phases -> Compile Sources and look at the differences in files added, basically in the new target was missing 'GoogleUtilities/UserDefaults' and 'GoogleUtilities/MethodSwizzler' but this can be different in any case, so i just did a compilation like this
platform :ios, '13.0'
def google_utilites
pod 'GoogleUtilities/AppDelegateSwizzler'
pod 'GoogleUtilities/Environment'
pod 'GoogleUtilities/Logger'
pod 'GoogleUtilities/MethodSwizzler'
pod 'GoogleUtilities/NSData+zlib'
pod 'GoogleUtilities/Network'
pod 'GoogleUtilities/Reachability'
pod 'GoogleUtilities/UserDefaults'
end
abstract_target 'AggregatedPodsTarget' do
use_frameworks!
google_utilites
pod 'FirebaseCore'
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
pod 'FirebaseStorage'
pod 'FirebaseFunctions'
pod 'FirebaseAnalytics'
pod 'FirebaseMessaging'
pod 'Firebase/Crashlytics'
pod 'Google-Mobile-Ads-SDK'
target 'MainApp' do
end
target 'MainApp Dev' do
end
end
abstract_target 'ExtensionPodsTarget' do
use_frameworks!
google_utilites
pod 'FirebaseAuth'
pod 'FirebaseFunctions'
target 'Extension' do
end
target 'Extension Dev' do
end
end
after this i just did pod install and i went back to have only one GoogleUtilities Dependency
This worked for me, it's similar to this Bogdan's answer
Summarising steps
Add pod 'GoogleUtilities' so they don't clash from different targets
Clean install your pods (pod deintegrate and pod install)
Might need pod repo update.
Reopen xcode and archive, you would see single GoogleUtilities now
I saw this error when I tried archiving one of my projects where I had recently introduced another new target.
Going into the pod settings for this new target, I noticed that the iOS deployment version was different (14.4) from the iOS deployment version in the main Runner target (12.0) - something I had missed when I was initially configuring this new extension target.
The only difference between the iOS deployment versions I saw was that 14.4 had App Extensions enabled. Since that was something inconsequential to my project, I was happy matching the iOS deployment
versions for both my targets so they could refer to only one set of dependencies. After that, I just removed the duplicate pods for the version that I had removed. And I could archive again.
For each of your Targets, got to Build Settings -> check the iOS Deployment Target -> change the version so that they match.
For most circumstances, there is no reason why they should be different. But if for some reason you deem they should be different, checkout Paul Beusterien's answer and follow that.
We had the similar issue on Flutter project using firebase_core and firebase_analytics dependencies. Adding pod 'GoogleUtilities', '~> 7.7.0' in all the targets in the Podfile under ios folder.
target 'Runner' do
use_frameworks!
use_modular_headers!
pod 'GoogleUtilities', '7.7.0'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
target 'customnotificationext' do
use_frameworks!
pod 'GoogleUtilities', '7.7.0'
end
I'm using framework targets (for better code reuse and IB_Designables), and I've already had a framework target working perfectly. I've decided to move some other classes to a framework target too.
I've set up the pods (just a single one in this case), but whenever I try to include the pod I'm getting not found error.
No change if I try to use the modules approach too:
The problem is that I've already got another framework too, with the same settings (cross checked all the compiler settings/linker flags/build phases etc) and that framework has no issue importing its pods.
Here is my podfile (TUComponents is the working on, TUModels is the failing one):
[...]
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
use_frameworks!
end
target 'TUModels' do
pod 'JSONModel'
use_frameworks!
end
Even weirder; Xcode has no problem code-completing importing the JSONModel/JSONModel.h header (or JSONModel in case of module #import). But when I try to compile, it fails.
What might be wrong with my configuration?
UPDATE: If I give up using frameworks in pods and use regular old static library, and set allow non-modular includes in frameworks to YES, I can build. But I have no idea why I can't build when using Pod frameworks.
Maybe try solution from: https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/
platform :ios, '9.0'
use_frameworks!
# My other pods
def testing_pods
pod 'JSONModel'
end
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
testing_pods
end
target 'TUModels' do
testing_pods
end
From iOS - Build fails with CocoaPods cannot find header files :
Make sure your Podfile includes link_with on targets missing a config file. Cocoapods only sets the first target by default otherwise. e.g.
platform :osx, '10.7'
pod 'JSONKit', '~> 1.4'
link_with 'Pomo', 'Pomo Dev', 'Pomo Tests'
Restarting Xcode fixed it for me
The following steps worked in my case:
Quit the Xcode n Simulator
Delete Drived data
Again open your project
Clear it
I've been learning swift for three days. I'm planning to build my skill in swift especially in iOS development. I just advised by my colleague who is an iOS developer to learn swift while writing test in our app -- this is for the benefit to the company and myself which it makes sense for me. Now, I'm trying to follow this tutorial
https://medium.com/#ynzc/getting-started-with-tdd-in-swift-2fab3e07204b
After following the tutorial to rewrite the test in a framework called Quick which is very similar with Rspec. I did the installation of the CocoaPod then follow the install of the Quick framework. Use the .xcworkspaces instead of the .xcodeproj. But still I'm getting the error of No such module 'Quick'.
I did research already and removing the pods but still getting the error.
platform :ios, '9.2'
target 'FizzBuzz' do
use_frameworks!
def test_pods
pod 'Quick', '~> 0.9.0'
pod 'Nimble', '~> 3.2.0'
end
target 'FizzBuzzTests' do
inherit! :search_paths
test_pods
end
target 'FizzBuzzUITests' do
inherit! :search_paths
test_pods
end
end
screenshot of the project folder:
I recently had this issue and none of the current answers solved this for me.
The reason I was getting this error was that the Test/Spec file (NetworkSpec.swift) that I had created had a target membership of the main application target, not the tests target.
To update this, I opened the project in xcode, selected the file in the project explorer and then in the properties window on the right hand side. Then in the target membership area. I had two options.
ProjectName
ProjectNameTests
I unchecked the checkbox next to ProjectName (not the app's real name) and then checked the one next to ProjectNameTests and re-ran the tests. Everything worked as expected.
I ran into the same issue. I did not need to nest the test targets in my podfile. e.g.
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'MyAppName' do
pod 'RealmSwift'
pod 'GoogleMaps'
end
target 'MyAppNameTests' do
inherit! :search_paths
pod 'Quick'
pod 'Nimble'
end
target 'MyAppNameUITests' do
inherit! :search_paths
pod 'Quick'
pod 'Nimble'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0' # or '3.0'
end
end
end
I am using Xcode 8.1. Click on the currently selected scheme.
Select 'manage schemes'.
Selected scheme.
Put check mark next to test schemes and Quick.
Click on your app scheme again. Select each scheme and go to Product > Build. Finally select your main app scheme again. Now try adding 'import Quick' in one of your test classes.
Schemes
ISSUE RESOLVED
I was getting same issue. Files within Test folder did not see Nimble and Quick pods despite my Podfile was configured correctly and Target Membership for my test file set up correctly as well. I was unable to import both Pods.
Running below commands on Project folder via CLI resolved issue for me.
$ pod update Quick
$ pod update Nimble
My Podfile implementation of both pods for reference:
def include_test_pods
pod 'Quick'
pod 'Nimble'
end
Try this. Cocoapods may need to be rebuilt.
Quit XCode. Go to terminal and cd into your project.
Run pod deintegrate.
Run pod install.
Open Xcode and clean and build your .xcworkspaces project.
I had this issue that persisted through build cleans. I noticed that it was only happening in one file and files that did not have this issue had import foundation. After importing foundation on the line before it, it then worked. I thought maybe it was simply modifying the file that had done it so I removed the foundation import and the error came back. So try adding that import if you do not have it.
First thing first you just need to use pod inside your target project, so it gona share for your test target like that
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'TestNetWorkLayer' do
use_frameworks!
pod 'SwiftyJSON'
pod 'Quick'
pod 'Mockingjay'
pod 'Nimble'
pod 'Alamofire', '~> 5.0.0-rc.3'
target 'TestNetWorkLayerTests' do
inherit! :search_paths
end
end
After that you can import it inside your project
import Quick
import Nimble
class NativeApiClientSpec{
}
In my Podfile i use smth like this:
target 'Specs' do
pod 'Quick'
pod 'Nimble'
shared_pods
end
Additionally, re-open the project or use the following command: Product -> Clean and build folder
I had same issue. After a lot of trial and error, I found fix here: https://github.com/Quick/Quick/issues/402#issuecomment-149459840. I had to delete derived data and regenerate project to get Quick as build scheme
Try this;
Close xcode project
Run $ pod deintegrate
Delete Podfile.lock
Run $ pod install
and Build again!
I've been banging my head against a wall with this for the last few days but despite multiple Google/SO/Github searches I can't find a resolution to the issues I'm having!
All I'm trying to do is create some unit tests for my app which makes use of Firebase pods.
I'm using Xcode 7.3.1 & Cocoapods 1.0.1. Update: Issue remains with Xcode 8.0
With this podfile:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
target 'MyApp' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
target 'MyAppTests' do
inherit! :search_paths
end
end
In my XCTest class I get
Missing required module 'Firebase'
error at #testable import MyApp
Alternatively with this podfile:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
def common_pods
pod 'SwiftyTimer'
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
target 'MyApp' do
common_pods
end
target 'MyAppTests' do
common_pods
end
The tests build but my console is littered with warnings e.g.:
Class <-FirebaseClassName-> is implemented in both ...MyApp... and
...MyAppTests... One of the two will be used. Which one is undefined
I had the same issue. I solved it by moving pod 'Firebase' to my test target. Change your Podfile to this:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
target 'MyApp' do
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
target 'MyAppTests' do
inherit! :search_paths
pod 'Firebase'
end
end
Try changing the inheritance to :complete, as in:
target 'MyAppTests' do
inherit! :complete
end
Importantly it allows anyone else checking out your repo to just do a pod update as usual without having to copy .xcconfig files or other hackery just to build.
Select your Unit Test Target setting.
Go to Build Settings.
Look for Header Search Paths.
Add this value $(SRCROOT)/Pods with recursive, then Xcode will resolve the path for you.
Here is Example
The issue is that Firebase does something special with the Header Search Paths after CocoaPods generates its own value for the setting so CocoaPods doesn't pick up on this change in order to carry it over to the test target. You can solve this one of two ways:
Locate MyAppTests.<configuration>.xcconfig in the file navigator and add the following to HEADER_SEARCH_PATHS:
${PODS_ROOT}/Firebase/Analytics/Sources [*]
Find the setting for Header Search Paths in Build Settings and add that same value as in option 1 to the list. You shouldn't need to set it as recursive.
* As per AKM's comment, this changed to ${PODS_ROOT}/Firebase/Core/Sources in version 3.14.0
Adding ${SRCROOT}/Pods/Firebase/CoreOnly/Sources into the unit test target's "Header search paths" fixed the problem.
Steps:
Select your unit tests target
Go to Build Settings
Search for header search path
Add ${SRCROOT}/Pods/Firebase/CoreOnly/Sources
After this the tests can run and the error will disappear.
Three Steps before I could get this to work:
CocoaPods : 1.5.0
Swift 4
Firebase : 4.13.0
Step 1:
Make sure to add the following target block into your podfile.
# Uncomment the next line to define a global platform for your project
platform :ios, '11.3'
target 'TIMII' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for TIMII
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
target 'TIMIITests' do
inherit! :search_paths
pod 'Firebase/Core'
end
end
Step 2:
Within the YourAppTests Project Navigator Build Settings tab. Find the Header Search Path row and add to Debug the following line
$(inherited) ${PODS_ROOT}/Firebase/Core/Sources
Step 3:
In terminal run:
pod update
A simpler method that also works:
target 'MyApp' do
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
target :MyAppTests
end
The problem is recorded in the firebase project here:
https://github.com/firebase/firebase-ios-sdk/issues/58
There is a workaround:
Add "${PODS_ROOT}/Firebase/Core/Sources" to your Tests target only
under Build Settings -> Header Search Paths
but this is also fixed by upgrading to CocoaPods 1.4.0 or later, which is a better solution.
At the time I'm writing this (November 2017) cocoapods 1.4.0 is still in beta, so to install it you need to explicitly request the beta:
gem install cocoapods --pre
This and then doing a pod install solved the problem running my tests.
I tried all the above and ran into various different errors, originally starting with Missing required module 'Firebase', then getting "Class ... is implemented in both ... " or linker issues if I tried to add Firebase Pods to my test target.
The solution that worked for me was to:
Remove test target entirely from Podfile and run 'pod update' to ensure the XCode project is in sync.
Open my test target's Build Settings and update header search paths to only include the following 3 items:
$(inherited) non-recursive
$(SRCROOT)/Pods/Headers/Public recursive
$(SRCROOT)/Pods/Firebase recursive
At this point cleaning the build folder, re-building then re-running the tests worked for me. Hope this helps someone!
The solution for me was to update cocoapods to version 1.1.0.rc.2.
sudo gem install cocoapods --pre
I had a similar problem. Phrased in terms of your question, I copied the contents of my MyApp.<configuration>.xcconfig file to my MyAppTests.<configuration>.xcconfig file. I cleaned and built the tests, and it worked.
Add "${PODS_ROOT}/Firebase/Core/Sources" to your Tests target only under
Build Settings -> Header Search Paths
As #Will mentioned an issue around Header Search Paths after CocoaPods installation.
I have a project with multiple targets where pod 'Firebase' embedded into separate module, lets say MyProject-Shared. Firebase pod at 'Podfile' installed only for 'MyProject-Shared' target. Other modules, which wants to use 'MyProject-Shared' can't be compiled due an error:
'missing required module "Firebase" '
The trick in my case was to add following missing header search path at each target's Build Settings referencing to Analytics-Framework:
"${PODS_ROOT}/Firebase/CoreOnly/Sources"
Please see pic below:
Hope it will save your time.
Missing required module Firebase NO CocoaPods solution
For those who encounter the same problem but NOT using CocoaPods:
If you're using Firebase, than you have some folder containing Firebase.h and module.modulemap file. For example - YOUR_PROJECT_DIR/Linking
If your Main project target is working correct way, than you should go to ProjectSettings -> Targets. Select test target. Search for User headers and add the path to YOUR_PROJECT_DIR/Linking. Select recursive option and you should be good to go.
See the screenshot for more details:
I've been trying to migrate my project to cocoapods.
I feel like i'm almost there but I'm stuck in:
ld: framework not found Firebase for architecture x86_64
error: linker command failed with exit code 1 (use -v to see invocation)
I'm trying to compile using my "app.xcworkspace" and the project looks like this:
Also:
I've tried starting other projects and firebase works there so it's a problem with THIS project settings... Any idea?
My podfile looks like this:
# Uncomment this line to define a global platform for your project
# platform :ios, ‘8.0’
target 'Parti' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Parti
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Database'
target 'PartiTests' do
inherit! :search_paths
# Pods for testing
end
target 'PartiUITests' do
inherit! :search_paths
# Pods for testing
end
end
It might be relevant to add that the error happens when xcode tries to "Link /Users/myname/Library/Developer/Xcode/DerivedData/Parti-gsdsljzobcnqjkgutfpjasgrsfck/Build/Products/Debug-iphonesimulator/Parti.app/Parti"
I know it sounds far fetch, but:
Clean the project. Product -> Clean
Restart XCode (not always needed)
Run pod update & pod installfrom the project folder
Update: The Podfile should more like:
use_frameworks!
target 'Parti' do
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Database'
end
target 'PartiUITests' do
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Database'
end
Make sure you have added $(inherited) in your Header Search Paths, Framework Search Paths and Library Search Paths for your project target.
Also make sure that in frameworks folder in your project file(Not in your Pods, click on the Project Name in the Project Navigator), the "libPods-YourProjectName.a" is not red. If yes, delete it and build again.
add $PROJECT_DIR/Pods (make it recursive)
to Framework search paths
for whatever reason only this helped me, maybe you too
Just found the answer. Seems like I had an old geofire version and the new one is not available as a Pod yet...
Github Issue link
Thank you for your answers.
Some hints :
Make sure that your Podfile is correct (did you forget to uncomment the use_frameworks! line ? Have you correctly added the pod ?)
Have you forgotten to run "pod install" ?
Have you tried cleaning the project and the build folder ?
Another possibility is your project name is not ASCII. For example, you may have Chinese characters in the name.
In such case, In "general" -> "Frameworks, Libraries, and Embedded Content", remove "Pods___.framework", and add the one with the right name under "Pods/" would help.