external library (pod) showing errors after updating Xcode - ios

I've updated Xcode to the latest and all these errors came. Then I downgraded my Xcode, but the errors still there.

Open Pods project
Select Target of the pod with errors
Open Build Settings tab
Search for Swift Language Version(SWIFT_VERSION)
Set proper Swift version for the pod
Build your project again
If build fails you set wrong Swift version, so repeat from 5
If some other pod will generate errors of this kind repeat from 2
Also, you may set some Swift version for Pods project itself, to set some default version.

Related

"failed to emit precompiled header" after downgrading Deployment target

Well This is a very common error by xcode and it has so [many] 2 answer on StackOverflow still I am facing this in a particular situation.
My project is running fine on iOS 11 Deployment target but when I try to downgrade my deployment target to iOS 10, it start to throw Module map file not found for every pod library.
What Have I tried:
Updated Podfile platform :ios, '10.0'
pod deintegrate then 'pod cleanand after that runpod install`
Clean DerivedData folder
Clean project couple of times using the combination cmd+opt+shift+k & cmd+shift+k
Check Objective-C Bridging Header.
Revert back deployment target to iOS 11 and it works on iOS 11
Removing pod which showing Module map file not found and then it's throwing build error where I have used those library.
How can I get out from this error?
P.S.:
It's a mixed project of obj-c and swift 4.2.
Xcode version 11.2.1(11B53).
Cocoapods version 1.8.4
model Map file not found
faild to emit precompiled header
From given set of information, it seems you are using color as an asset in your asset catalog like following screenshot
It requires min deployment target ios 11 to work. Stop using this feature if you want to run in ios 10.
Hope it helps.

Error - linker command failed with exit code 1

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

Build error with ios-charts

I have followed the guide here to install the ios-charts framework as an embedded binary and step 3 of the guide instructs me to build the project. The build then fails instantly as a result of adding the embedded binary. I have downloaded the most recent version of the framework, and it supposed to compatible with swift 3.
I am using X-code 8 beta, and hence swift 3. Can anyone point me in the right direction?
Download zip file with project
Build it
In Xcode find product folder, find there Charts product, show in Finder
Open your project in xCode
Drag & drop bundle(from step 3) to your project in xCode
Configure your project settings: in Embedded Binaries use "+" to add charts
1) Use CocoaPods (doc: https://cocoapods.org)
2) Add Charts to your pod file (doc: https://github.com/danielgindi/Charts)
Add pod 'Charts' to your Podfile. "Charts" is the name of the library.
For Realm support you can specify the subspec in your Podfile as follows:
pod 'Charts/Realm'
Note: pod 'ios-charts' is not the correct library, and refers to a > different project by someone else.
For Swift 3, you should go with CocoaPods.
Write pod 'Charts/Realm' this will install exact pod version for chart, then clean and build.

CocoaPods with React Native: `ld: library not found for -lReact`

I am integrating React Native with an existing iOS app. I have followed the guide on integrating with an existing app.
After reading some other posts on the subject, I have tried:
Setting the architecture in the Pod build to match the project
settings in Xcode
Adding / moving the Pod build above the project build in the Scheme
Is there anything else I may need to check?
Make sure you open xcworkspace file generated by pod install instead of your old xcodeproj file and then select the right scheme
In my case I had to change my deployment target to 11.0. I had changed my Pods level to 11.0 but not the xcode setting. Look in the Deployment Info section of your target General tab right next to the iPhone/IPad checkboxes.

Header file not found in Bridging Header after upgrade to XCode 7

I have some project which I wrote using XCode 6 with iOS deployment target and which was working fine on iOS 8.
Recently I upgraded XCode to 7.0.1 (7A1001) and now I have to make some changes in mentioned project. I can't event build it.
I'm using CocoaPods and I have UIColor+BFPaperColors imported : pod 'UIColor+BFPaperColors', '~> 1.3.1'.
XCode is telling me that he can't find UIColor+BFPaperColors.h file. It's strange because I have this file in my project (Pods project in Workspace) and it was working fine with XCode 6.
What I already tried to do (but with no result) :
Convert project to latest Swift syntax (Edit -> Convert -> To latest Swift syntax...).
Set Allow non-modular includes in Framework Modules to YES.
Did pod update and pod install.
PS. Here is my Podfile.
do you use the Build Setting to set bridging header? maybe this picture will
help you

Resources