Forgive me, I am new to IOS Development. I have debugged this for a while now and tried all available solutions I could find. I added Pods to my Xcode project and the build now fails. I verified that after running "pod deintegrate; pod clean" the build works again. When I run "pod install" again and open the .workspace (not the .xcodeproj) - the build fails. I have tried every solution I could find.
I have already tried:
Deleting derived data (many times)
Restarting computer/xcode (many times)
verifying that I am opening the workspace, not the project
cleaning the project and re-building (many many times)
Deleting the Pod-.framework from the Frameworks folder and reading it to the Linked Frameworks and Libraries
Editing the build scheme to include Pod-.framework
Adding the pod frameworks to the Linked Frameworks and Libraries
Adding the pod frameworks to the Embedded Libraries
Editing the Framework Search Path in Build Settings
Building to an actual device and simulator
Heres my Podfile:
#platform :ios, '12.0'
target 'Burnt' do
use_frameworks!
pod 'MaterialComponents'
end
Versions:
MacOS version: 10.13.6
Xcode version: 10.1
Swift version: 4.2
CocoaPods version: 1.6.2
The Error:
ld: framework not found MaterialComponents
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Helpful Screenshots:
File Structure
General Settings
The Evil Error
please check MaterialComponents github version you are using right one or not
or try with
pod try MaterialComponents --> on github page
Try changing your swift version to 5 and compile and then you can change it back to 4.2 ..seems like some xcode linking glitch..
Can you compare your Project version(swift_version) and installed pod version are same?
i think this OS issue update your macOS and also update cocoapods.
Try new project to install pods.
Related
I'm new to XCode Mac and IPhone development. So probably I'm missing something obvious here.
While trying to build the project I'm getting the following warnings and error. I can't figure out what is wrong here, I've looked at this answer and checked my Framework Search Path value and there is none in BuildSettings.
ld: warning: directory not found for option '-F/Users/macbook/Desktop/<app_name>__main/build/Release-iphoneos'
ld: warning: directory not found for option '-F/Users/macbook/Desktop/<app_name>__main/build/Debug-iphoneos'
ld: framework not found Pods_<app_name>
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've been banging my head for several hours now and finally given up.
The path mentioned in the error does not exist and when I looked into where build folder is located in XCode project, I realized they are in a shared directory ~/Library/Developer/Xcode/DerivedData. So I don't understand why XCode is looking for these files in the project's relative path, where build folder doesn't exist.
I'm using
XCode 10.1
CocoasPod 1.5.3 1.8.4
MacOS High Sierra
Note: The same workspace builds successfully on another system.
Edit:
If I copy the project.pbxproj from the other system onto this one, the project on this machine builds successfully too. project.pbxproj is located under *.xcodeproj file.
Also if I select Generic iOS Device the project builds fine, but as soon as I switch to any other target device I get the same error.
Edit 2:
I see a couple of framework files in red in the left side folder/directory's panel.
Foundation.framework
Pods_<application_name>.framework
Solution:
So right now I've found a solution what I believe to be a workaround and not the actual solution.
In my project's folder structure I saw multiple .framework files in red. some of them had different extensions then the ones present in the xCode package. So I updated them with the newer extension files and that got rid of most of the red file frameworks and left just one Pods_.framework the same framework in the error above. I removed the framework from the Libraries and Framework list in the General section. After I did that project build fine and I was able to run the app.
However, I noticed the Pods_<app_name>.framework file is always regenerated after running pod install. So I have to manually remove this unwanted dependency from the list each time starting a new workspace which is pain to say the least.
And so now I'm looking for a way to correct this so I don't have to remove the Pods_<app_name>.framework file each time.
While I was searching for the solution I found a closed cocoapods bug which reported the same issue for an older version. I've lost the thread and cannot find it again otherwise I would've linked the bug.
As noted in one of the answer's comment I now have updated cocoapods version 1.8.4.
Edit 3:
Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '7.0'
# Uncomment this line if you're using Swift
use_frameworks!
target '<app_name>' do
pod 'Google-Mobile-Ads-SDK', '~> 7.39.0'
end
Based on your comment and build logs I believe the podfile Pods_<application_name> is not available to your project(its added but not downloaded).
Pods are a way to share code across projects and maintain versioning.
You just need to update the pod so that it gets downloaded and added to your project. For that just launch Terminal app, cd to your project folder and fire pod update (you may refer to https://freakycoder.com/ios-notes-12-how-to-update-pods-249ecf88fe57)
If you do not have pod installed you can head to https://guides.cocoapods.org/using/using-cocoapods.html
I used to run into that problem once but I already solved it the same way #alxlive answer and it worked.
The problem happened to me because of the pod that we already installed.
During that time, I already installed my cocoapod for my project. Then, I added 2 new Build Configurations.
Your problem might be the same because you did mention copying others project.pbxproj from other system and it made your project work fine. So that might be the case.
By deintegrate and install the pod back on, that will solve the problem.
Xcode has different build system for simulator and real devices. So it will generate different app for both. If you select any Simulator target then it will builds app for simulator and if you select Generic iOS Device or any real device target then it will builds different build.
May be you are using some frameworks which are builded for iOS devices, So
follow this steps,
Differentiate that frameworks which gives you an error and remove that pods from your pod file and run pod install command and delete DerivedData.
Download that framework's code in your system.
Add project files of framework in your workspace. For that you can refer this and this.
If you don't want to add whole code of framework in your project then you can add particular( for device or simulator ) build of framework in your xcode project.
For that follow this steps,
Open your downloaded project of framework.
Select any simulator target and build project.
Get generated .framework file from Products folder.
Add this framework in your project like this.
Now build your project for simulator.
Follow above steps for devices target if you want to build for devices.
For Google Mobile Ads you can follow this guidelines. Add the -ObjC linker flag to Other Linker Flags in your project's build settings
I hope this will work for you.
Adding -ObjC $(inherited) in the Other Linker Flags fixes my issue
For me it was due to having a space in the Configuration name like "Development Debug". Once I removed the space and made it "DevelopmentDebug", the error message went away.
The pods need to be installed once per mac. The configuration set in the project.pbxproj depends on the Cocoapods version and the Xcode version on the machine.
Try the following:
1 - Delete the Podfile.lock file and the Pods folder from the local project
2 - Delete the content of the Derived Data folder: ~/Library/Developer/Xcode/DerivedData
3 - Run the command:
pod deintegrate
4 - Run the command
pod install
5 - Run the project again
I updated Xcode to version 10 recently and started to receive a strange error when trying to build my project. I'm currently on Swift 4.0 and I did try to upgrade to swift Version 4.2. But when I did I received this same error in many of my frameworks.
Command Compile Swift failed with a nonzero exit code
So far I've deleted the derived folder. Updated all pods, also deleted all pods and reinstalled them using the terminal commands below.
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod clean
pod install
This didn't work to fix my issue. However, I found something that could work which was adding arm64 architecture in Build Setting -> valid architectures and enabling automatic code But, when I checked it was already there and code signing was enabled already.
Additionally, I do have a few other build errors that have to do with frameworks.
SwiftMessages
Value of type 'SwiftMessages.Config' has no member 'presentationContext'
WhatsNewKit
Missing argument for parameter 'backgroundColor' in call`
I opened issues with the developers of each of these frameworks to seek help with these issues.
Issue On SwiftMessage GitHub
Issue On WhatsNewKit GitHub
When I click presentationContext it brings me to the struct within the SwiftMessages Framework. Usually, when I've had the "has no member" warning I cannot click to see the original place where it exists.
I assume this has something to do with cocoa pods, but haven't been able to find a solution yet. What can I do to correct this issue? If anyone could help would be deeply appreciated been stuck on this for a day now.
Update:
The two frameworks latest builds were for swift 4.2. When I changed the version of each framework to one that was built in swift 4.0 I got the project to build.
Make sure that, your project Swift Language Version is in the proper version. SwiftMessages 6.0.0 works with Swift 4.2.
I solved this way:
Comment all pods in your .pod file
From your terminal, run the command pod install --no-repo-update
Open Xcode perform a clean and rebuild the project
Now open your .pod file and uncomment the first library
From your terminal, run the command pod install
Repeat steps 2 - 3 - 4 -5 for each uncomment library in your .pod file
I hope it can be of your help.
Make sure that, Your project build settings Optimization Level is in No Optimization[-Onone].
for pod SwiftMessages if your app is not swift 4.2 you need to user the version 5.01
pod 'SwiftMessages', '~> 5.0.1'
and it will work like a charm
Set Swift version to 4.2 then pod deintegrate, pod install, fix this problem for me. Thanks #alejandro-iván
Good Morning!
Do a clean. using"commond + shift + k
Close Xcode.
Navigate to project directory where the Podfile exist.
Do pod update/pod install
Open x.xcworkspace
This error happened to me when I used same class name in two different groups. Then I renamed one of the classes and the problem was solved
All of the answers were helpful to me. In my case, I only install frameworks manually but this kind of problem also happens. I tried all of the answers and was still getting this issue during the build. Curiously, while coding, I could cmd-click and resolve all of the "missing" components. I also cleaned and deleted derived data, restarted Xcode, etc.
I eventually got it working by inducing these additional steps:
On each of the framework project/targets (including my own):
Verify consistent Swift version (4.2 in my case)
Set Build for Active Architecture Only to No
Set Valid Architecture to arm64, armv7 (to match with base project)
Set Optimization Level to None (for Debug)
Set Compilation Mode to Whole
I had several frameworks (homegrown) plus my app. Somehow they ended up being out of sync as far as the Swift version. Make sure that all frameworks are the same version. In my case, they all needed to be set to Swift 4.2. If you haven't done the migration to 4.2 then remember that Xcode helps with this: Edit -> Convert -> To Current Swift Syntax.
only for re-install pod using that command pod install
see below attachment
In my case I connect an actual iphone not simulator and run the app once on it, It solved the problem. But connect iphone firstly, then choose it from this menu, then press run button.
The problem will solve too.
I stumbled upon this problem when upgrading to Xcode 10.2 and Swift 5. After trying everything I found this in the release notes:
The Swift compiler may crash during a build when the Thread Sanitizer
is enabled. (48719789)
And sure enough, efter turning off Thread Sanitizer my project could be compiled without errors again.
So if you get this error and have Thread Sanitizer enabled - turn it off!
Same issue happened to me in Xcode 10.2, it was a Xcode bug..!
So, I opened in older Xcode version(9.4), and it worked fine. Then I updated to the Xcode 10.2.1 after it's release -> Clean and build your project, now my problem solved.
I'm having the same problem, my Xcode version is 10.2.1 (10E1001),
Cocoapods version is 1.7.0.beta.2.
I returned to Cocoapods 1.6.1 and the problem was solved.
The specific steps are:
pod deintegrate to cancel the integration.
Uninstall all Cocoapods.
for i in $( gem list --local --no-version | grep cocoapods );
do
gem uninstall $i;
done
Install the stable version of Cocoapods. For now it's 1.6.1.
gem install cocoapods
Clean Project and empty DerivedData
pod install
Recompile the project
In my case it was a code error:
self.myDto.map{ (dto)} in
var stringValue = (dto.value(forKey: "name") as! String)
stringValue.append("c")
return stringValue
}
Just removed that stringValue variable fixed the problem.
I just had the same error message and none of the answers here and in the duplicates of this question were applicable to my project or helpful.
I kept on reading through the error messages and came to a realisation that I had stupidly named two seperate swift files in different folders with the same name intending to change one, but before I got to change one, I tried to run my project and have been annoyed for the last hour.
Bottom line, don't accidentally name your files the same name and read your error codes thoroughly!
target 'XYZ' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for xyz
pod 'SwiftyJSON'
pod 'Localize-Swift'
pod 'Alamofire'
pod 'Kingfisher'
pod 'Tabman'
pod 'RSSelectionMenu'
pod 'Pushbots'
pod 'ACProgressHUD-Swift', '~> 1.4'
pod 'SKPhotoBrowser'
pod 'ZoomableImageSlider'
pod 'RSSelectionMenu'
pod 'DropDown'
pod 'ImagePicker'
end
I updated platform :ios, '10.0' to 11.0 and the error disappeared. Change your platform or OS version and check. Hope that could help.
Specify your pod's version for example pod 'RealmSwift', '~> 5.3.5'
or uncomment # platform :ios, '9.0' in your Podfile
I faced this issue on Xcode 14. Add this on podfile bottom.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# some older pods don't support some architectures, anything over iOS 11 resolves that
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
I realize that the same error was asked in other questions (like here), but their solutions are not working for me.
I keep getting a build failure in my app: "No such module 'Alamofire'". I followed the cocoadocs installation instructions (here) for installing Alamofire and it still is not working. I made sure everything has the same deployment target.
Embedded Binaries and Frameworks
Here's my podfile text.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.2’
use_frameworks!
target 'MyApp' do
pod 'Alamofire', '~> 3.0'
end
target 'MyAppTests' do
end
target 'MyAppUITests' do
end
Also, I tried "$ pod install" again in Terminal and got this message:
[!] The `App [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
After following Sohil's suggestions, XCode now recognizes the Alamofire module, but 22 new issues have arisen.
Update #2: So I'm now on Xcode 7.3 and Swift 2.2, but I'm receiving a new error with the workspace Link: "ld: framework not found Alamofire. clang: error: linker command failed with exit code 1 (use -v to see invocation)."
Do the following things and you can import any swift file from "Pods"
1) Clean your project
2) Make sure that all your "Pods" > "Build Settings" > "Build Active
Architecture Only" is set to "NO".
3) Don't run, just build your project.
4) Now, import any file from "Pods" to any swift file
E.g.: import Alamofire
5) Again, build project and it will work as expected. Finally, you can
access it properties
Update:
For the updated question, I hope you are using Xcode 7.3 so please update the Alamofire to Swift 2.2
Hope this helps!
Please check this screenshot
and compare to your build setting
may this is helpful to you
For me the solution was to open the "App".xcworkspace as pointed by the cocoapods documentation
The steps was:
Close project
Close xcode
Go to terminal
type "open |App|.xcworkspace"
When I opened Xcode it was still pointing the error then I built the project (cmd+b) and everything is fine now.
The target overrides the OTHER_LDFLAGS build setting.
Use the $(inherited) flag in TARGENTS -> Build Settings -> Framework Search Paths
in my case, i couldn't run archive after change bundle name. I've cleaned build folder and run pod install then everything worked fine.
Xcode version: 7.0.1.
OS-X: Version 10.11 Release.
Project details: Built for iOS 7 or above, CocoaPods: AWSCore (Problematic one, other Pods build fine), other developers are on Xcode 7.0.1 as well but not on El Capitan.
When I try to build, I get "linker command failed with exit code 1 (use -v to see invocation)", along with a few warnings linked to the error.
Warning 1: "ld: warning: directory not found for option '-L/Users/sonny/{PROJECT_NAME}/build/Debug-iphoneos'"
Warning 2: "ld: warning: directory not found for option '-F/Users/sonny/{PROJECT_NAME}/Pods/HockeySDK/Vendor'"
Warning 3: "ld: library not found for -lAWSCore"
Solutions
I've tried: I've tried a complete pod remove master repo, pod setup, pod install. I've tried verifying that the architecture settings are the same for build on both my project target and pods target. I've tried deleting entries on Testing->Debug && Release in Build Settings along with putting $(inherited) in all the linker files and framework search entries.
Other issues that might be related: In the Project Navigator, all of my Frameworks Podfiles are red, indicating an incorrect folder reference. But wouldn't pod install correct this? I simply can't find the pods.a files anywhere in my project folder but I do not know if this is what's causing the build to fail.
Project builds for all other developers but not me or my supervisor. I'm on El Capitan but he isn't.
Solved:
This was my solution and keep in mind, the solution for everyone will be different -
In {Project Name} target, under your specific "General" if you scroll down you'll have a list of Frameworks. You want to delete ALL the Pod listings there "libPods-this or that.a". Those frameworks have been linked in a bash script and in other places during a Pod install, but Pod install didn't delete them from the project build listing.
Once you remove all those, it should build.
I am using XCode 4.5.1 and iOS 6.0 base SDK.
Here is the error I am receiving:
i686-apple-darwin11-llvm-gcc-4.2: /Users/fahim/Library/Developer/Xcode/DerivedData/Currenthiphop-emodxxwwaiojlcboaxuodksuwuww/Build/Intermediates/PrecompiledHeaders/Pods-prefix-evibdktwbatdnbabmrlnderfsxxi/Pods-prefix.pch.dia: No such file or directory
There is only 1 file in the Pods-prefix-xxx directory:
Pods-prefix.pch.pth.hash-criteria
Here is my Podfile:
platform :ios
pod 'LibComponentLogging-Core'
pod 'LibComponentLogging-LogFile'
pod 'LibComponentLogging-qlog'
pod 'LibComponentLogging-pods'
pod 'Facebook-iOS-SDK'
pod 'RestKit'
Any help is appreciated. Thank you!
I actually found this solution right here that details opening up Xcode using normal means (Finder or the Dock), as opposed to using the open <Workspace>.xcworkspace command. I've always used Xcode from my dock, whereas the other developer (who couldn't build the project and was getting the error you were) was using the open command from the command line. Once he opened Xcode from the Dock, and manually browsed to open the project that way, he could build it successfully.
If you are using CocoaPods 0.18.0, this might be cause by CocoaPods and is fixed in https://github.com/CocoaPods/CocoaPods/issues/956
Extra quote in "$(inherited)" was the cause (https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/generator/xcconfig.rb#L150). It should not be quoted. If you remove them from the xcconfig the project will build again. You may want to check your xcconfig and see if there are extra quote.
This issue can be caused by a few different factors but in my case and the case of some colleagues, this resolved the missing pch.dia
Uninstall CocoaPods and install 0.17.1
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 0.17.1 --verbose
Lock your Kiwi version to 2.05 if Kiwi is one of your pods:
target :KiwiUnitTest, :exclusive => true do
pod 'Kiwi', '2.0.5'
Clean your Xcode project including Derived Data. Close down Xcode, re-open the project and build.