Library not found for -lBraintree - ios

I have added Braintree with other lib using pods. My build is failed because it can't find library for Braintree. Here's what I have:
ld: library not found for -lBraintree
clang error: linker command failed with exit code 1 (use -v to see
invocation)
Things I've tried:
Used .xcworkspace instead of .xcodeproj
Set build active architecture NO
Removed any red lib.a
This is what my project looks like:
I don't see a -lBraintree flag in the last picture yet it shows here -ObjC -ObjC -l"AdIdAccessLibrary" -l"Braintree" -l"DI... why?
Podfile
target 'MyProject' do
pod 'Braintree', '3.9.3'
pod 'Google/Analytics', '~> 1.0.0'
pod 'GoogleIDFASupport'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
end
target 'MyProjectTests' do
end

Related

IOS app wouldn't launch due to error "ld: 34 duplicate symbols for architecture x86_64"

I tried doing a clean build, uninstalling/reinstalling pods, not too sure where to go to next.
I never received this error before, but I first got it when I tried integrating Firebase into my project. I made sure to add all of the correct pods, I then went ahead and added a few other Firebase pods, just in case. I'm not sure if it has anything to do with this, but here is what my pods file looks like.
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Effortflex' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!
# Pods for Effortflex
pod 'RealmSwift'
pod 'IQKeyboardManagerSwift'
pod 'Firebase'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'FirebaseFirestoreSwift'
end
Here is a sample of the error...
/Users/owner1/Library/Developer/Xcode/DerivedData/Effortflex-bmtqbbukvlosxpbraqoiwplpcfyj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
duplicate symbol '_pb_encode_fixed32' in:
/Users/owner1/Library/Developer/Xcode/DerivedData/Effortflex-bmtqbbukvlosxpbraqoiwplpcfyj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode 2.o
/Users/owner1/Library/Developer/Xcode/DerivedData/Effortflex-bmtqbbukvlosxpbraqoiwplpcfyj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_encode.o
ld: 34 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help would be greatly apprecaited!
Something that helped me was to the following -
In terminal navigate to your project folder
Run 'pod deintegrate'
Run 'pod install'
After that my project was able to compile. Hope that works for you!

ld: library not found for -lCocoaLumberjack

I updated pods for SalesforceSDKCore 4.3.1 and SalesforceRESTApi 4.3.1. When I did pod install it in turn installed cocoaLumberjack library which is a dependent library I suppose. After successful install of Pods, I couldn't build successfully, as I am getting this error -
ld: library not found for -lCocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I deleted my Library search paths, added/deleted inerited in Other linker Flags, nothing seem to work. These are my search path and other linker flag settings.
My Pod file -
# platform :ios, '8.0'
target 'Custom' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Custom
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'SalesforceSDKCore'
pod 'XMLDictionary', '~> 1.4'
pod 'SalesforceNetwork'
pod 'SmartStore'
pod 'SmartSync'
end
I had the same problem. I tried many solutions, some of them are:
File/Workspace Settings/Derived Data Arrow -> Delete DerivedData folder, empty trash
Terminal -> pod deintegrate , pod install
If you renamed your target's name, then:
Target/Build Settings/Test Host :: $(BUILT_PRODUCTS_DIR)/TargetName.app/TargetName
I really hate this linker command failed problem. I get it all the time and every time I need to follow another solution to solve this. I must have given over 30 hours of my life to this s#$t.

"framework not found AFNetworking for architecture arm64" for my Test Target

This is what I see when trying to run tests under test target in my iOS App:
ld: framework not found AFNetworking for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is how my podfile looks like:
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.2"
def pods
pod 'AFNetworking'
pod 'Fabric'
pod 'Crashlytics'
pod 'MagicalRecord'
pod 'SDWebImage'
pod 'SVProgressHUD'
end
target 'MySoberRoomMate' do
pods
end
inhibit_all_warnings!
I am new on IOS development and did not have the required reputation to add comment so that I am posting answer.
I did a little work with pod file and i think the pods for the test target is not added in pod file so that the compiler showing the error.
do some thing like this in the pod file for the test target
target 'TestTarget' do
pods
end
add your test target name in place of 'TestTarget'
Hope it works.

Why do I add a third-party libraries with pod after engineering complains?

XCode7
this is my Podfile
platform :ios, '7.0'
pod 'XMLDictionary'
pod 'Base64nl'
pod 'ASIHTTPRequest'
pod 'AFNetworking'
pod 'MWPhotoBrowser'
pod 'PinYin4Objc'
pod 'Pingpp'
New project pod after the install is an error
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's the problem?
How to solve?
After installing CocoaPods , you must re-open your project using *****.xcworkspace file , NOT ****.xcodeproj file. Otherwise you would get this error.

Pods library is linked twice with first target, as libPods.a and libPods-<targetname>.a

I have the project, that contains two targets one for iOS and one for OSX.
Here's how the Podfile looks like.
# Pods
xcodeproj 'ipolypus.xcodeproj'
pod 'BlocksKit'
pod 'Reachability'
pod 'MKStoreKit'
# Objective C
pod 'libextobjc'
pod 'LinqToObjectiveC'
target :ipolypus, :exclusive => false do
platform :ios, '5.1.1'
pod 'CocoaLumberjack'
pod 'EGOTableViewPullRefresh'
pod 'SVProgressHUD'
pod 'FlurrySDK'
# AdMob SDK and AdMob mediation adapter
pod 'AdMob'
pod 'AdMobMediationAdapterIAd'
end
target :ipolypusTests, :exclusive => true do
pod 'CocoaLumberjack'
end
target :'ipolypus-osx', :exclusive => false do
platform :osx
pod 'CocoaLumberjack'
end
After running pod install I can see that two Pods libraries are linked against the first target (ipolypus).
libPods.a and libPods-ipolypus.a
If I try to build the project right away, I will get strange link errors, like missing FlurrySDK symbols.
To fix it, I have to remove libPods.a and libPods-ipolypus.a from the list of libraries to link with the target, run pod install again, then manually remove libPods.a for the first target and then it will build and link.
There must be something wrong with the way I make that Podfile. I checked related posts, couldn't find similar problem.
Update
Here's the link error
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Flurry", referenced from:
objc-class-ref in IOSAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After I do the steps described above, I will have successful builds until next pod install or pod update.
I should also mention, that the project had single target for quite a while, then I added OSX target and modified Podfile for that, and that's when the problems started.
But I tried to remove Podfile.lock and to wipe Pods folder, still the problem occurs.
And I had another type of error, where linker failed because the same symbol was already defined, but I don't see that one anymore.
I got to the cause of "double-linking" problem.
It's caused by the structure of the Podfile, as expected.
Since I wanted to have some common pods available both for OSX and iOS targets, I put them all in the beginning.
xcodeproj 'ipolypus.xcodeproj'
pod 'BlocksKit'
pod 'Reachability'
pod 'MKStoreKit'
# Objective C
pod 'libextobjc'
pod 'LinqToObjectiveC'
These common pods will be in libPods.a library, also, CocoaPods can't stand the fact that some pods library is not linked against a target, so it will link libPods.a against default project target, in my example it's ipolypus.
Then there's libPods-ipolypus.a generated for ipolypus iOS target. Since this target is not exclusive, things like FlurrySDK will be included into both libPods.a and libPods-ipolypus.a, resulting into duplicated symbols while linking.
After trying to figure out the proper way to use exclusive/non-exclusive target configs, I ended up with separate list of pods for each target. Might be a bit longer than I would want, but does the job as expected.
# Pods
xcodeproj 'ipolypus.xcodeproj'
target :ios, :exclusive => true do
platform :ios, '6.0'
link_with 'ipolypus'
# shared
pod 'CocoaLumberjack'
pod 'Reachability'
pod 'MKStoreKit'
pod 'LinqToObjectiveC'
# pod 'EGOTableViewPullRefresh'
# platform
pod 'SVProgressHUD'
pod 'FlurrySDK'
# AdMob SDK and AdMob mediation adapter
pod 'Google-Mobile-Ads-SDK'
pod 'AdMobMediationAdapterIAd'
end
target :iosTests, :exclusive => true do
platform :ios, '6.0'
link_with 'ipolypusTests'
pod 'OCMock'
end
target :osx, :exclusive => false do
platform :osx, '10.7'
link_with 'ipolypus-osx'
# shared
pod 'CocoaLumberjack'
pod 'Reachability'
pod 'LinqToObjectiveC'
end
target :osxTests, :exclusive => true do
platform :osx, '10.7'
link_with 'ipolypus-osxTests'
pod 'OCMock'
end

Resources