When building the workspace throws a warning:
Target Pods - {AppName} product Pods_{AppName} cannot link framework Foundation.framework
This started after updating to Xcode 9.4. I updated CocoaPods to the latest version, v1.5.3, but it didn’t resolve the warning.
This is due to using the new build system in Xcode. The issue has not been resolved in the latest version of CocoaPods yet, v1.5.3 as of writing this.
For now, you can resolve the warning by adding this post_install action to your pod file:
post_install do |installer|
podsTargets = installer.pods_project.targets.find_all { |target| target.name.start_with?('Pods') }
podsTargets.each do |target|
target.frameworks_build_phase.clear
end
end
After updating your pod file run pod install again.
Source: CocoaPods: Cannot link framework Xcode warning
Related
I am trying to update my xCode project with latest libraries, but I have errors building my project. Here are the details:
xcode 13.4.1
Cocoapods 1.11.3
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'la soundbox' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'FirebaseCore'
pod 'FirebaseFirestore'
pod 'FirebaseAuth'
pod 'FirebaseMessaging'
pod 'FirebaseInAppMessaging'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'
pod 'FirebaseRemoteConfig'
pod 'Google-Mobile-Ads-SDK'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Before installing anything, here is what I do:
Clear Build folder
Exit xCode
Run those commands
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf /path_to_project/Pods
rm /path_to_project/Podfile.lock
Restart mac
Launch xCode and build project
I have this error that keeps coming up (From FirebaseInAppMessaging pod, in FIRInAppMessaging.m):
'FirebaseCore/FIRAppInternal.h' file not found
Did not find header 'FIRAppInternal.h' in framework 'FirebaseCore'
What could be done to avoid this error ? I'm struggling on this and I really don't know what can I can do anymore
I have a project running on Xcode 12.3; it's in Objective-C and uses CocoaPods. The 3rd party libraries are built only for devices, not for simulators, so when I run my app on iPhone with iOS 13, the project builds successfully but I get the following error:
dyld: Symbol not found: _$s9SwiftGRPC17ServerSessionBaseC15initialMetadataAA0G0CvM
Referenced from: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
Expected in: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/SwiftGRPC.framework/SwiftGRPC
in /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)
The pod file is as below:
pod 'SwiftGRPC', '~> 0.9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CleverTap-iOS-SDK', '~> 3.7.1'
Why am I getting this error and how can I resolve it?
Have you tried setting BUILD_LIBRARY_FOR_DISTRIBUTION to true for all your frameworks to ensure module stability?
You'll need to set the flag to true in your app (under project settings) as well as in your dependencies by adding a post install script at the end of your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
Original solution here
I am getting this error when I run my flutter project in iOS simulator:
warning: [CP] Unable to find matching .xcframework slice in myProject/ios/Pods/FirebaseFirestore/FirebaseFirestore/abseil.xcframework abseil framework ios-i386_x86_64-simulator ios-x86_64-maccatalyst ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).
In android emulator and iOS device it's working fine.
Worked for me:
rm ios/Podfile
Then upgrade your packages:
flutter pub upgrade
And update your podfile:
cd ios && pod update
Then clean and run:
flutter clean && flutter run
In order to fix that issue I was needed to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes for the library. You can do that manually but changes will be lost once you re-run pod install.
In order to set that automatically you can make necessary changes in your ios/Podfile, here's code example:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
This was inspired by another answer, you can find more info if you need by following that link https://stackoverflow.com/a/64139830/1078641
I want to build my Xcode project (react native & swift) for the simulator and on a real device.
The simulator worked great. Today I tried to build it for my device, I selected my device in the Xcode bar and added the scheme to release (I had to do this because I'm using react native and otherwise the bundle is not packed)
Then an error during the build occurs (in this case for the dependency RNPurchases, but this is completely random. sometimes it's Expo-Keep-Awake or Facebook)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RCPurchases", referenced from:
objc-class-ref in RNPurchases.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Even switching the back to Build Configuration Debug in my scheme has no effect anymore.
I already tried several things:
clear Xcode build
delete pod folder
remove pod cache
remove Xcode/DerivedData
reboot
nothing works.
This problem is pretty new to me, it already occurred twice within the last 2 months. Somehow I got the build for the simulator running again, but never for a device. I didn't have the problems like this half a year ago ...
My Setup
Xcode 12.4
MacBook Pro (Big Sur 11.2.3)
Build Settings for App-Target: Build Active Architectures Only: Debug YES, Release NO)
Build Settings for Pod-Target: Build Active Architectures Only: Debug YES, Release NO)
Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb' # expo uni modules
use_frameworks!
install! 'cocoapods', :deterministic_uuids => false, :warn_for_unused_master_specs_repo => false
target 'TrainUrTeam' do
platform :ios, '12.0'
# ... pods xyz
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
end
post_install do |installer| # src: https://stackoverflow.com/a/64139830/6003494
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
After 2 weeks of googling I could finally find a working solution according to this Post adding this to the Podfile:
use_frameworks! :linkage => :static
If use_frameworks! :linkage => :static is not an option for you, you may try to use:
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPurchases')
def pod.build_type;
Pod::BuildType.static_library # pods version >= 1.9
# Pod::Target::BuildType.static_library # pods version < 1.9
end
end
end
end
I got these errors and just restarted my macbook, clean, then build and they disappeared. Magic.
Go to xcode project -> Build setting -> Architecture -> Excluded
architecture -> (arm64)set
Try to build & run
i have some problems with xCode 8.
I have converted my .xCodeproject in swift 3.0 sintax
i Have installed all cocoapods compatible with swift 3.0
Here my pods
So every pod require the legacy swift version OR xCode return ditto error OR xCode return some error about the pods sintax. Please help me.
to remove the pods requiring legacy swift version manually changed to YES task, add this script to your podfile. It will go through your pods and set it to use the 3.0 version
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
configuration.build_settings['SWIFT_VERSION'] = "3.0"
end
end
end
1.latest xcode 8
2.if already pod file created in your project so then u do this command
open -e podfile
and then
use_frameworks!
target '<your project name>' do
pod 'Alamofire', '~> 4.4'
//your all pod put here above end
end