my project was running fine but when i added alamofire and it is not working.
it is giving following error
ld: warning: directory not found for option
'-F/Users/banglafire/Desktop/mysios/Build/Products/Debug-iphonesimulator/Alamofire'
ld: framework not found Alamofire clang: error: linker command failed
with exit code 1 (use -v to see invocation)
additional information
Cocopad version 1.3.1
my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'My' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for My
pod 'Alamofire'
end
How do i solve it? Please help!
I was facing same problem. So i think you are opening .xcodeproj. you need to open .xcworkspace
I think there are some issues with your Pod file should be as below:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'My' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire', '~> 4.4'
target 'MyTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyUITests' do
inherit! :search_paths
# Pods for testing
end
end
try to remove Pod file and again install the pod file and add pod-like this. Hope this could help you.
Try to add the version of the alamofire
pod 'Alamofire', '~> 4.5'
Then run pod install
Did you update your pod on project folder already ?
Also check if your pod is correct or not.
https://github.com/Alamofire/Alamofire
When you add something pod on your project, you still need to update your folder.
Try use terminal -> then go to your folder project -> type pod install
I recently encountered this problem aswell.
I tried a lot of the suggested fixes on here, but none of them actually fixed the problem.
The actual problem was an incorrect value that was set in the Build Settings of the app.
After setting Per-configuration Build Products Path to:
CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
the problem was resolved and my build succeeded.
Related
I am trying to use the GooglePlaces iOS API; however, every time I follow the directions for installing it via CocoaPods, I always get a Linker Command error. I've tried the steps about a million times and always get that error after building. Furthermore, I am using the workspace file that documentation recommends and I believe that I have followed all of the steps correctly. Can someone please help me?
Xcode version: 8.3.2 (8E2002)
Pod File Content:
source 'https://github.com/CocoaPods/Specs.git'
target 'MoodSwings' do
pod 'GooglePlaces'
end
Xcode Error:
ld: framework not found GoogleMapsBase
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks!
First I Deintegrate Cocoapods from your project using this link Deintegrating and Removing Cocoapods from your project after that using pod init I create pod file again this is the podfile updated content
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MoodSwings' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MoodSwings
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
target 'MoodSwingsTests' do
inherit! :search_paths
end
target 'MoodSwingsUITests' do
inherit! :search_paths
# Pods for testing
end
end
After that I remove all configurations in Build Setting -> Framework Search Path and your project finally works!!
here is the repo Github repo
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.
I'm trying to include Alamofire in my Swift project following the github(https://github.com/Alamofire/Alamofire#cocoapods) instruction.
I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods. Then I faced following error:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
After searching I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods
Now I generate a pod file by pod init and edited it this way:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Law
pod 'Alamofire'
target 'ProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
Finally I run pod install to install Alamofire. After that I open the project and import Alamofire statement gives me following error No such module 'Alamofire'
Update-1: Results of pod install is:
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Open the .xcworkspace not the .xcodeproj
go to Product -> Scheme -> Manage Schemes...
and check Alamofire true
this work for me
Sometimes with no reason xcode can't load a module Alamofire. It can happen after a work session, after opening a project. The fix for this is to select a schema -> Alamofire, and run. If the message is "Successful", the schema can be changed back to project and it will work with no problems.
I suggest you to change your pod file like this below:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Alamofire', '~> 3.0' <<<---- Alamofire library is cross beetween projects
target 'NotifyM' do
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
Another thing is use_frameworks! you should use this if the project is Objective-C based and try to use Swift pod library.
UPDATE: for the new cocoapods version 1.x the shared library should be like this:
# There are no targets called "Shows" in any Xcode projects
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# Has its own copy of ShowsKit + ShowWebAuth
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# Has its own copy of ShowsKit + ShowTVAuth
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
as indicated into cocoapods website :http://guides.cocoapods.org/using/the-podfile.html
you have to clean project and build, before you can import that library.
Install this way Pod file
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'NotifyM' do
pod 'Alamofire', '~> 3.0'
end
target 'NotifyMTests' do
end
target 'NotifyMUITests' do
end
I suggest that and it's work for me :
platform :ios, '8.0'
use_frameworks!
target 'App' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
end
After that, run : pod install in your project repository
2021 M1 USERS
according to: https://developer.apple.com/forums/thread/123614?answerId=683594022#683594022
close XCode
open Finder app and show there "Applications"
right click on icon Xcode and click on "Get info" (or something similar)
there is checkbox "Open with Rosseta" (or something similar). Select it
run Xcode again and try to build
it worked for me hope it works for you.
After a lot of efforts and all solutions provided above. I have fixed on Xcode 13.0:
Use for Simulator:
Go to:
- Build settings -> EXCLUDED_ARCHS = arm64
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64 x86_64
Use for Realm Device:
Go to:
- Build settings -> EXCLUDED_ARCHS =
- Build settings -> VALID_ARCHS = arm64e armv7 armv7s arm64
You should tap the Target to select Alamofire and build it once before coding.
When using Cocoapods to include dependencies always open your .xcworkspace
In Podfile use use_frameworks!
Remove any linked libraries from build phases.
In Build Setting look for Framework Search Path and add $(inherited) in both debug and release.
Do the same for Header Search Path too.
Now try a clean build.
I installed Google Sign In via cocoapods, but when I tried to compile got this error
ld: framework not found GoogleAppUtilities
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'Project_name' do
pod 'PayPal-iOS-SDK'
pod 'Google/SignIn'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Project_name
target 'Project_nameTests' do
inherit! :search_paths
# Pods for testing
end
target 'Project_nameUITests' do
inherit! :search_paths
# Pods for testing
end
end
I installed the PayPal library first without problem.
I'm using .xcworkspace
Tried cleaning and building again, using $pod deintegrate
clean the project and $pod init again and nothing seems to change.
In Xcode, look in the Pods project for a file named GoogleAppUtilities.framework. It's probably under the Pods/Products folder. You need to add a reference to this file (GoogleAppUtilities.framework) in your main project. In you main app project file go to the build settings tab and look at the list named "Link Binary with Libraries"...you need to add a reference here to the GoogleAppUtilities.framework file.
Just adding your comment as the solution: it worked for mee too:
Solved, I thank you. Your answer did not solve the issue, but It gave
me an idea. I did that and in Build
Settings->SearchPaths->FrameworkSearchPaths I added the framework in
Debug and Release.