After I update my Firebase via "pod update", I got error like this :
ld: warning: directory not found for option '-F/Users/bennysantoso/Library/Developer/Xcode/DerivedData/FCM-atfcxuircoryufazlomgwfgmvaqm/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here my Podfile :
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'BB' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BB
target 'BBTests' do
inherit! :search_paths
# Pods for testing
end
target 'BBUITests' do
inherit! :search_paths
# Pods for testing
end
end
Does anybody know about this error?
I seek out relationships GoogleToolboxForMac and Firebase, but I just get a little bit of information.
FYI, I use Swift 2.3 and Firebase 3.8.0.
I will be grateful for any help you can provide. Thanks!
I had the same error. Once you install the pods, you'll see the following message.
[!] Please close any current Xcode sessions and use MyApp.xcworkspace
for this project from now on.
I didn't notice this for the first time and was trying to build the project using the regular xcodeproj file. After I saw this message, I opened the right project and it worked fine.
Once you open this project you'll notice that you have two subprojects. One would be your project, and another would be the Pods project.
Framework Not Found
When using Pods, we usually face this issue.
There are two main reasons for this
When we open the .xcodeproj file instead of .xcworkspace as mentioned by izaaz-yunus in this Answer
When Build Active Architecture Only is set to Yes in Build Settings
This applies to the projects target and also to all the targets in the pod project
Main Project Screenshot
Pod Project Screenshot
Select Build Settings (of main project, pod project both)
Select each Target one by one
Set Build Active Architectures to No for each target
Finally clean and rebuild your project.
In my case all integration are well-done and also did try so many time to remove and reinstall pod but did not get success.
Finally try with below step
Projetc->Manage Schemes -> Select check box "Pods-MyProjectName"
And get success.
GoogleToolboxForMac is a dependency of Firebase/Messaging. Details in the podspec. When doing "pod update", Cocoapods should set up your workspace to build and link GoogleToolboxForMac.
It sounds like something about your workspace is in a bad state. Does Product -> Clean help? What about deleting Derived Data and the ModuleCache (Xcode -> Preferences -> Locations -> Derived Data)?
It shouldn't be necessary, but you could also try explicitly adding pod 'GoogleToolboxForMac/Logger' to your Podfile.
its work's
1. select your project in directories
2. select General
3. Add "GoogleToolboxForMac.framework" to the Linked "frameworks and Libraries"
This was fixed by adding $(inherited) in the Build Settings -> Search for LIBRARY_SEARCH_PATHS.
This is understandable, since when updating your pod file for the latest versions of libraries which your project depends on, the debug output tells you where you need to add all the $(inherited) flags:
LIBRARY_SEARCH_PATHS
OTHER_LD_FLAGS
GCC_PREPROCESSOR_DEFINITIONS
Go to : target -> Build Settings -> Other Linker Flags -> remove framework "GoogleToolboxforMAC" and build the project.
I had the same issue when I tried to run it on my device. On the simulator it was working fine. I tried some of the above but it didn't work for me. I checked that I was working on .xcworkspace instead of .xcodeproj file, so I tried this one. Follow these steps to:
Open Xcode project (cocoapods project) using .xc... file.
Select Pods project in the project navigator (blue icon on left).
Under Targets, ensure Pods-ProjectName (blue icon) is selected.
Navigate to Build Settings and set the iOS Deployment Target on which iOS version you are going to run project.
Note:It is same as what you set in Project->Targets->Deployment info->Deployment Target.
Maybe someone get benefitted from this.
If you're facing the same error, in your XCode, go to:
Your Project > your target > Scroll down to Linked Framework and Libraries and check if the Library entry is dimmed:
If so, remove and add it again. In my case, I had duplicated entries and one of them was dimmed (when XCode can't find them on disk).
Closed the project that I was trying to build after I did pod install then opened the .workspace and then everything builds perfectly.
Open the your-project.xcworkspace in your project destination.
1)Open terminal -> 2) $cd /project_destination -> 3) $open your-project.xcworkspace
or just open the file in finder
Make sure your "Build Active Architecture settings" for both your project target and the pod are same. Setting NO in both these cases fixed my issue.
My issue was that I had a /bin/sh script that copied specific Pods which didn't exist. This was one of them. Removing the script resolved the build issue.
-I search in harddrive for the GoogleToolboxForMac files, found in :
/Users/Marco/Documents/iosapps/BomRetiro/Bom Retiro/Pods/Target Support Files
And then i copied the files to this folder :
/Users/YourHomeFolder/Library/Developer/Xcode/DerivedData/Bom_Retiro-bsfjbazzzuwmuidqurdmjvdtnnsb/Build/Products
And then for me is resolved opening the project usinf .xcworkspace file.
For those still having issues after all this.
I am working on a cordova project and the issue suddenly appeared after upgrading to XCode 11.5.
Finally I was able to solve it by opening the pods.json file in the project root and remove the entry in "libraries" which belongs to "FirebaseMessaging".
We were not using that and I dont know how it got there.
Additionally I have changed the "Build Setting" -> "Build Active Architecture Only" to "No" everywhere.
Afterwards I opened the .xcworkspace file again and the build ran through.
Worked solution is
Search GoogleToolboxForMa in xcodeproj
Remove all references from the build configurations
Swift 5 Simple Answer
Shift+Alt+Cmd+K //Clean the project and Run again!
//if not work restart Xcode and again clean it
//Its will work happy coding
Friends, you must be confused with the exact result, as i was. So, i feel to share the
screenshot that might be helpful. We all had to be careful that we need to change the flag for property **"Build Active architecture Only"** for **pod target** to **NO** And build, it would not show the linking error.
See the attached screenshot.
Screen Shot 1, Screen Shot 2, Screen Shot 3
[Select Pods][1]
[Select Targets in the pod][2]
[Change flag to No][3]
[1]: https://i.stack.imgur.com/E7mjX.png
[2]: https://i.stack.imgur.com/wCwET.png
[3]: https://i.stack.imgur.com/KVGKM.png
Related
I'm trying to add a framework to my IOS project but when I build I always got the same message :
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to remove my Pods directory and then run pod install
I open the .xcworkspace like it is written in the logs on the pod install, I clean the project on xcode and then try to build but it won't works..
My podfile looks like this :
xcodeproj '/Users/guillaume/project/Mobile/iOS/FoodPin/FoodPin.xcodeproj'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftHTTP', '~> 0.9.2'
My version of xcode is 6.3.1
Thank you,
In Project Navigator in the folder Pods I had a Pods.framework in there which was red. It was also present in Linked Frameworks and Libraries. I removed both references and the error disappeared.
TL;DR
Remove Pods.framework in:
Folder named Pods
Linked Frameworks and Libraries
This is usually caused by having the .xcodeproj file open instead of .xcworkspace.
When you run 'pod install' for the first time, it will create an .xcworkspace file, which includes your original .xcodeproj and a Pods project. You'll need to close your .xcodeproj and open the .xcworkspace instead.
This is a common issue when creating a project through Xcode's new project wizard - I often forget that I'm not in a workspace, which is required to get Cocoapods to link correctly.
Xcode 9, 10, 11, 11.5
install https://github.com/CocoaPods/cocoapods-deintegrate
pod deintegrate
then
pod install
I cleared this error by deleting the red .framework files that were located in a folder Frameworks in the project navigator. I think this also automatically deleted corresponding red entries in the Linked Frameworks and Libraries section of the General settings.
I have been cleaning / reinstalling pods in order to fix another issue. Perhaps these red framework files and entries were just leftover from a previous pod install?
I had a similar issue as
framework not found Pods_OneSignalNotificationServiceExtension
It was resolved by removing the following. Go to target OneSignalNotificationServiceExtension > Build Phases > Link Binary with Libraries and deleting Pods_OneSignalNotificationServiceExtension.framework
Hope this helps. Cheers.
For who find this issue. I am using NativeScript and got the same error.
That happen becouse I opened the file .xcodeproj, but we must open the project by the file .xcworkspace.
This happened to me after updating my Podfile and doing a pod update.
For some reason, I had a "Pods_[ProjectName]".framework file appear under my project under 'Targets' > General > Linked Frameworks and Libraries.
Deleting this and then clean/rebuilding fixed the issue.
you should delete your project some file as this picture.
I was getting this error because i renamed my project and change the name of project in pod file too but my project was referring to old name which was not there and causing this error . I get rid of this by
pod deintegrate
followed by
pod install
Just Remove your .framework from the list of "Your Project->General->Linked Framework & Libraries".
It's happened to me because I changed the Deployment Target in General but forgot to change the Deployment Target in Pods > General.
[Xcode 11.2.1]
For me it was different app target version in Podfile(platform :ios, '11.0') and in Xcode project file .
It causing Archiving job fail in CI pipeline.
Matching both value fixed an issue! Hope this help anyone.
This issue was driving me crazy as it suddenly happened without doing any changes to the project. I've tried all suggested solutions in this thread (and other related) and none of them solved the problem.
The only thing that differed from my other projects (which compiled fine), was that this project name was containing an accent (a french accent, "é"). I've renamed the project and all related files, and it finally worked !
Maybe this is related to updating to Xcode 10, because this project was working well before...
EDIT : it also seems to failed when using a project with - in project name…
In my case I can build it on devices and simulator but has the same errors when archiving. To solve it, I have to
remove Pods.framework
make sure Pods-<project-name>.framework is embedded
You will find the settings in TARGETS-->Linked Frameworks and Libraries.
In my case, after comparing the difference between a branch I knew built correctly, I noticed this line in my Podfile:
platform :ios, '11.0'
I had inadvertently up'd my target version from 10 to 11 while my targets in Xcode remained set to 10. Reverting back to 10 solved my issue for me.
Ensure your target iOS versions are properly set.
Step 1
The first thing that you will need to do is remove the Podfile, Podfile.lock, the Pods folder, and the generated workspace.
Step 2
Next, in the .xcodeproj, remove the references to the Pods.xcconfig files and the libPods.a file.
Step 3
Within the Build Phases project tab, delete the Check Pods Manifest.lock section (open),Copy Pods Resources section (bottom) and Embed Pod Resources(bottom).
Step4
Remove Pods.framework.
The only thing you may want to do is include some of the libraries that you were using before. You can do this by simply draging whatever folders where in the pods folders into your project (I prefer to put them into my Supporting Files folder).
It worked for me.
Using Xcode 8.3 the accepted answer didn't work for me. I had tried many other solutions but #Elliott Davies answer is what fixed it for me. I'm adding a screenshot for clarity. For some reason, Xcode was trying to link previous podfile setups that no longer existed. All I had to do was delete the extra references and everything worked.
You're more than likely trying to get the pods to work into you project right?
The only way to do so is by creating a separate project that uses CocoaPods.
Close all work-spaces that you are using.
Next, make sure you have your Podfile completely ready to go.
In the command line, wherever your file is, type the command:
pod deintegrate
Then, install your pod agian.
pod install or pod update
Now you can use your project's new workspace to develop from. Look for a file called .workspace. Use that file!
Here is a guide on using CocoaPods
This is the way i fix my problem. and it now work when i writing this answer:
Firstly, i try all the most fix way above,
remove Pods_xxx.framework from the link libraries and framework in target's build phases is helpful, and the issue will disappear, but the coming problem is i can't import the Pods.framework anymore.
And Then, i try to reinit the xcworkspace config, so that i can figure out the real problem. so i run
pod deintergate
and then install my pod again:
pod install
this work prefectly, but the problem is still in there, but i figure out the real problem is the Pods_xxx.framworks not be compiled succeed by cocoapods build script. I think this is the true way to fix the problem.
Finally, i try to edit my project's scheme:
and i add Pods scheme into manage:
and build this Pods.framework separately, and you will find the Pods.framework icon become truly again:
and i think now you have fix your "framework not found Pods_xxxx.framework" problem
but actually i have another problem coming:
so i go to the build setting, and edit the "Framework Search Path" with "${inherited}",
and now all the problems goes out, cheer!!!!:)
After removing and updating pod I still had same issue.
I've found that previous developer put flag in 'Build Settings -> Other Linker Flags' with Framework name (in my case -framework 'OGVKit') that made the issue.
After deleting that flag, project builds properly.
Other thing that solved my problem is to go under Target -> Build Settings -> Other linker Flags and delete the "-framework" and your framework "name".
It happened when i tried to remove a pod.
in my case, my problem was the following: ld: framework not found UserMessagingPlatform.xcframework
for me, the solution was the following:
open a finder window and go to the ios folder
look for the following files:
Pods-[YOUR PROJECT NAME].release.xcconfig
Pods-[YOUR PROJECT NAME].debug.xcconfig
open those files and remove the following text: -framework "UserMessagingPlatform.xcframework" in both files
I did experience this problem because I did not set the platform correctly.
So in my macOS app I had the platform set to:
platform :ios
instead of
platform :osx
In my case, there was a reference to the library I removed on
Targets > Build Settings > Runpath Search Paths
Removing the library from Podfile and updating it obviously didn't remove it, so I had to do it manually and now everything works.
None of the previous answers pointed out the root problem in my situation.
So I hope this may be useful to someone else.
In my case I ended up having to edit my podfile at the root of my project. When I first created my podfile, swift static libraries were not supported.
So I had been using use_frameworks! in my podfile under each of my targets as such:
BEFORE
...
target 'targetName' do
use_frameworks!
pod 'podName', '~> 0.2'
end
AFTER
...
target 'targetName' do
pod 'podName', '~> 0.2'
end
I removed use_frameworks! from my podfile which kept installing the frameworks every time I ran pod install. After removing this line, make sure to run pod install again and remove any of the red .framework references from your Frameworks folder in Xcode. (Though mine appeared differently as attached below.)
Image of Removing .framework files that are no longer necessary
You can also read more about use_framework! here.
I had the same issue after removing some pods from my project.
First I have used pod deintegrate after that pod install in the terminal but didn't work for me.
So I went to the second step inside my project Build Setting and on the Other Linker Flags option, I have found that the deleted frameworks are not removed so I removed them manually.
I have resolved this issue.
delete these three files.
Podfile.lock
Pods folder
.xcworkspace
Then open your project in terminal and run pod deintegrate command, and after then run pod install command
I resolved this issue by selecting the project which downloaded from CocoaPods and built it, you can click Manage Schemes so that it can be appeared in Run bar. Then you can rebuild your project. Hope it help.
I tried every answer on here and none of them worked. I ended up getting it working by upping the deployment target from 10.0 to 11.0. I have no idea why that fixed it, but I suspect it has to do with upgrading to Xcode 10.2.1.
maybe you suddenly open the wrong file of .xcodprj and you should open .xcworkspace
I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working
Using Xcode 7
I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich's page
Only change from above link is the podfile -- which is from GitHub page here because the version has been updated. I have also used the Swift 2.0 branch.
Below is the snapshop of the error, my pod file and my terminal post installing the pod
PODFILE
TERMINAL
P.S: I want to use cocoapods to install Alamofire. I don't want to download it from github page
The Trick for me was to open the .xcworkspace file rather then the original project file itself.
working this:
Scheme -> Manage Schemes...
checked Alamofire checkbox → Build Alamofire scheme
and, if you used Playground , you should change settings Playground:
View -> Utilities -> Show File Inspector
Platform OSX → iOS
Try this one.
For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from https://github.com/Alamofire and you are done.
or if you want to install Alamofire from Cocoapods then try below code.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 2.0'
import Alamofire after importing UIKit
Then comment it out, build the project first.
Uncomment it.
(this worked for me, and others, when the other answers did not).
For reference to anyone who comes across this problem in the future:
Swift 2.x + CocoaPods 1.x
Symptoms: build works in Xcode for debug configuration but fails when xcodebuild is executed from console using pod lib lint or similar command. The result is error: no such module 'X'
Solution:
In MyProject.podspec add your dependencies without specifying versions:
spec.dependency "Alamofire"
The Podfile should also contain the same dependencies. Then run:
$ pod install && open MyProject.xcworkspace
You should open .xcworkspace instead of .xcodeproj. The build will now work in both Xcode and console and pod lib lint passes validation.
I wrote this because I was trying to publish a new CocoaPods pod library and had a similar issue but found no answer and also because Google leads to this question.
Here is what to do:
close your project,
install your pod library,
then install alamofire.
After you do all things, don't open the file with extension .xcodeproj but open the file with extension .xcworkspace
My problem was solved using these steps :
Clean Project
Goto Project > Build Setting > Framework Search Path
and add
"$PODS_CONFIGURATION_BUILD_DIR/Alamofire" as non-recursive
$(inherited) as non-recursive
$(SRCROOT) as recursive
Adding Alamo Fire to all of my target's build phases fixed it for me.
There is only one way to solve this issue.
Quit Xcode.
Delete project's temp files located at
/Users/username/Library/Developer/Xcode/DerivedData
Delete ProjectName.xcworkspace
Delete Podfile.lock file and Pods folder Run pod install.
Open the newly created ProjectName.xcworkspace file and build.
credits to Dimitris Bouzikas here
Have been facing the same problem, following trick resolved the issue
Go to Manage scheme -> Select pod library that is causing issue -> Build
Change back the scheme to project and then run the app, you are good to go
Note: If you don't see the pod library in the scheme, go to Manage scheme and select the pod library that you would like to build.
After doing #satoshin answer, I also had to check the Shared box on the right hand side of the Manage Schemes window.
go to finder locate the project and navigate to the '.xcworkspace' file. thats where your pods are installed. if you go to your original project '.xcodeproj' you will only the pod debug files. hopes this helps. took me a while to figure out the problem too.
I am using swift 3, I fixed this problem by deleting Derived Data for this project.
Cheers...!!!
If clean project/restart xcode/reinstall cocoapods etc, did not work. You can try running Product -> Build for -> Testing (cmd + shift + u). The build failed but the import worked right after.
As for me worked to change the name of the project. Accidentally put
ProjectNameTests
instead of
ProjectName
No schemas needed if you've configured the names correctly everywhere:
Check Podfile
Check which project file you've launched.
(The white icon should be created for "xcworkspace")
Product -> Clean Build Folder
Product -> Build (Now you can run in a simulator).
Start from the scratch, because most of the errors always occur in a cause of humanity mistake, not developers.
If you've put the wrong name for project in Podfile check "Linked Frameworks...". If so - delete this framework. The path is showed below at screenshot.
Example of correct Podfile (Alamofire):
'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'ProjectName' do
pod 'Alamofire', '~> 4.7'
end
ProjectName should not contain any extensions(file types).
[For future seekers] you could have missed the second step from the below :
Go to Project Setting
Go to Build Phase tab, create a new run script phase and add an input file to your Alamofire framework. In my case I set $(SRCROOT)/Carthage/Build/IOS/Alamofire.framework
Go to General tab, scroll down to linked framework and libraries add Alamofire.Framework folder. You probably won't find it from list so you need to press "Add Other" button and introduce it yourself.
For absolute newbie just close xcode project and open by the new way.
Choose in your folder file which contains extension like this: .xcodeproj and just enjoy you life.
For me, solution was to exclude arm64 devices from Pods and Project.
Image is in attachment.
You can start by making sure you open the Xcode workspace file (with the extension .xcworkspace) instead of the project file (with the extension .xcodeproj). The workspace file contains dependencies installed by CocoaPods, and it is necessary to use it to work on your project.
I've been reading all the issues about the error:
dyld: Library not loaded: #rpath/Bolts.framework/Bolts
Referenced from: /private/var/mobile/Containers/Bundle/Application/1542F906-CCE1-4181-AC7C-B5E3EE50E7D7/eBikeMotion.app/eBikeMotion
Reason: no suitable image found. Did find:
Which makes my application unable to run in a real device (but it runs without any problem in the simulator.
Until certain point I thought that it was an issue with the frameworks I was installing, but after installing manually the original one that was throwing the error, Alamofire, and the next Framework throwing the error was the next one in alphabetical order (Bolts, as you can see in the code snippet)
So I've reached the conclusion that is indeed CocoaPods which is producing these errors. I've got the last version (0.37) with a clean install, Iv'e tried to create a new project, I've tried all the proposed solutions to this issue without any luck, so I have to open an issue, with the hope that someone can help me.
Regards.
After reinstalling the whole system and don't finding a solution, I've found that some of the Build Phases mandatory for CocoaPods to run properly were missing.
The solution for this problem goes for the next steps:
Deintegrate the cocoapods project (you can install the tool with sudo gem install cocoapods-deintegrate).
cocoapods-deintegrate on Github
Modify your Podfile:
You should define your target linking with link_with 'ProjectName'.
You should define the target for your pods: target 'ProjectName' do [pods here] end.
Make an install with pod install
After doing this, go to XCode and check the following settings:
Into project settings, under "Configurations" check that in Debug and Release you've got a Configuration set named Pods-ProjectName.[debug|release]
Into your target, under "Build Phases" you should have three new phases that should be named: Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources.
Make a clean, then build, then run into your device.
That's it.
In my case, I followed the above answer by #Jorge, but it didn't resolve the problem. The exact error was a bit different because the missing file was #rpath Pods.framework/Pods. I finally resolved it with help from CocoaPods issue #3586:
Go to target > General > Linked Frameworks and Libraries section
set both Pods.framework and Pods_target.framework to Optional.
Still trying to figure out exactly why.... this answer has some info: what-does-it-mean-to-weak-link-a-framework
I had to fix two issues:
Go to each target then Build Phases then Link Binary With Libraries and select Pods.framework. Set it to Optional.
Cocoapods did not create the needed run scripts for my second target. My first target had all scripts. The second not. So I copied all missing run scripts from the first to the second target. You need to tap on the small "+" sign on the top left, add a run script and paste the script from the other target. I've done that for Check Pods Manifest.lock, Copy Pods Resources and Embed Pods Frameworks.
Then it did run on the device. Finally.
Had same issue adding pods to WatchKit Extension. Linking main target with Watch app is not the best option at all. Found out that cocoapod 0.37.2 hasn't added 'Embed Pods Frameworks' script into build phase.
Script:
"${SRCROOT}/Pods/Target Support Files/Pods-ExtensionName/Pods-ExtensionName-frameworks.sh"
In order to have cocoapods generate the build phases Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources:
1 - Go to build phases and remove any custom modifications. I had to remove everything under the Link Binary With Libraries phase.
2 - Do a pod deintegrate (Or just remove the files yourself)
3 - Run a new pod install
This worked for me. Without the first step, it never did.
To Resolve this you need to change status in Link Binary with Libraries in build phase for pod_projectName.framework and Bolt.framework
I got the same error in my project.
get error in CommonCrypto.framework
Resolved error by changing Required to Optional
The easiest thing to do would be to ensure that your Protobuf.framework is a dependency in your target's scheme inside the Build step.
This tells Xcode to compile the Protobuf.framework created by your pod install/update whenever it builds your target.
I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working