How to remove all references to a library? - ios

I have a pretty classical error during my project building:
ld: library not found for -lAppLovinSdk
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Originally I got the library from Cocoapods pod, but then I started having a lot of errors and decided to remove the pod from the Podfile and executed pod update
My Podfile looks like this:
I've tried to clean project, reinstall the Podfile, deleting Pods folder and Podfile.lock file, "Build Active Architecture Only" is set to "No", but I still have the error. I assume I still have some references to libraries from the deleted Pod. What is the way to get rid of them?
UPDATE: Here is a full error message:

Ok, so I figured out the problem:
I had to go to Target -> Build Settings -> Linking -> Other Linking Flags and there I had to remove all deleted libraries references, manually. And then it worked!

Related

Linking Xcode iOS project with OCMock using cocoaPod

I installed OCMock using cocoapod for my test project
target 'ProjectTests' do
use_frameworks!
pod 'OCMock'
end
In My test project, Build Phases -> Link Binary with Libraries, I added OCMock.framework (Under Pods). But the actual file doesn't seem to exist there. Am I missing something?
In Build setting, updated Header/Library search path with '/Pods/OCMock/Source/**' (recursive).
My headers are getting referenced, but when I try to the tests I get an error
ld: framework not found OCMock
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone help me resolve the issue?

iOS/Google Ads giving Linker Code Failure

Trying to insert Google Ads/Firebase into a test app. Suspect I've almost got this working but. Using the Google notes from https://firebase.google.com/docs/admob/ios/quick-start
When I compile I receive "Linker code failed with exit code 1":
ld: warning: directory not found for option '-L/Users/edward/Library/Developer/Xcode/DerivedData/TotalConversion-gtwxqoywudjqpodqkpfpwcnovyuz/Build/Products/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have created the Podfile as instructed with:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’7.0’
target 'TotalConversion' do
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
and then run a pod update. I don't see a .xcworkspace file referred to in the docs. Does the iOS, '7.0' line above need to be altered?
I presume that using pods GoogleAds is instead of the standard framework (Build Phases/Link Binary) approach.
If there is a linker error, this might be few things. First, check if you haven't open .xcodeproj instead of .xcworkspace by mistake. If not, the solution might be simple project cleaning by pressing cmd+shift+k. At last, check if those libraries are linked with project and are having status required in your target's general/build phases (Pods_YourProjectName.framework).
In Podfile you can actually comment out lines with source and platform by placing # in front of them. Go to terminal, cd to your project directory and try pod install once again, maybe that will do the job.
Sorry for not placing this in comments but my reputation doesn't allow me doing it.
The {projectName}.xcworkspace folder should be in the same folder as the .xcodeproj that you have open. Close Xcode {projectName}.xcodeproj instance and open {projectName}.xcworkspace using the Finder, command line, or Xcode open.

Xcode error: library not found for -lGoogleToolboxForMac

I am trying to install admobs in my iPhone App (written in objective-c). I have implemented this many times using swift projects, but currently I keep getting the following build error:
ld: warning: directory not found for option '-L/Users/charlieseligman/Library/Developer/Xcode/DerivedData/ThamesClippers-csissodainpbbjenykdyxuutzxtg/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: warning: directory not found for option '-L/Users/charlieseligman/Documents/GIT/iOS.ThamesClippers/build/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am definitely opening the .xcworkspace file (and not the .xcodeproj file).
I have also tried deleting 'DerivedData' folder contents & 'Cleaning' the project and doing a 'Clean Build Folder'. None has resolved the issue.
My podfile only includes the following pods:
# Pods for ThamesClippers
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
# Trying to fix GoogleToolboxForMac missing error
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac/Logger'
pod 'GoogleToolboxForMac', '~> 2.1'
I have tried adding the bottom 3 one-by-one but kept getting the same build error.
Can anyone help? At a complete loss on this one. Seen these two questions but their accepted solutions have not resolved this issue:
Framework not found GoogleToolboxForMac
ld: library not found for -lGoogleToolboxForMac
Finally worked out a fix:
Xcode > Product > Scheme > Manage Schemes
Select to 'Show' the scheme that was failing (GoogleToolboxForMac)
Select this scheme in the dropdown, just to the right of the 'Stop' button
Build this scheme
Then select the original scheme (in the dropdown mentioned in step 3) and rebuild
All built correctly.
So it looked like I had to build the separate scheme manually.
Note: To build these automatically, use Product > Scheme > 'Edit Scheme' > Build > And make sure all targets are added with your project target at the bottom.
I got this error in Xcode 10 when building to the Simulator. This is because I deleted the Debug base configuration in the xcodeproj when attempting to resolve the Cocoapods warning:
"CocoaPods did not set the base configuration of your project because your project already has a custom config set."
I resolved the issue by:
Adding the Debug base configuration
Setting the Debug configuration value to None
Running pod install
This is how the base configuration should look like after step 3:
]1

Xcode 7 build failed due to ld: library not found for -lGoogleAnalyticsServices

I have been struggling to get my xcode project to build for the last couple hours. I keep getting the following error:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried almost everything. I saw that the Google Developers website said to use pod 'Google/Analytics', even after trying almost everything I could find on StackOverflow and Google regarding the error, I have had absolutely no luck.
I upgraded to XCode 7 yesterday, everything seemed to work yesterday but today suddenly I started getting this error.
If someone has anything I can do about this error, please help!
Pointing me in the right direction to get it fixed would be awesome too!
Thanks in advance for your help.
The linker flag has been renamed to:
-lGoogleAnalytics
but the Cocoapods settings have not been updated yet. Rename the entry in "Other Linker Flags" and your problem will be solved.
Also, the library (as of the moment I write is version 3.13.0) does not support Bitcode yet, thus please turn off Bitcode in Build Options > Enable Bitcode > Select "No". Clean & Rebuild afterwards.
Same problem occurred in my project. What I did, I just updated all my pods and after that my app got compiled.
Run "pod update" command from terminal in your project directory where the pod file is located.
Please make sure you opened .xcworkspace not .xcodeproj.
Go to Library Search Paths in Build settings and
add
$(PROJECT_DIR)/Pods/build/Debug-iphoneos
$(inherited)
pod install again.
Update cocoapods to the newest version that supports 64 arch.
sudo gem update cocoapods
Delete all Valid Architectures and Re-Add the architectures that you just removed.
Clean and run
Without looking directly at your build settings, there's a number of things that could be causing this. The main issue is in your linker flags you likely have something lingering/incorrect. Most of your pods have the prefix of:
-lPods-WhichIt-SomePodsLib
However your GoogleAnalyticsLibrary has the prefix:
-lGoogleAnalyticsServices
This might indicate a lingering flag from your. Try looking for this entry in Other Linker Flags (Under Build Settings) and clear this out and re-running pod install.
Other things to check:
Cocoapods version is latest stable version
You are using the latest version of Google's official Analytics pod
Your library/framework search paths (build settings) are correctly pointing to the analytics library in question.
For the record, I've had issues with pods and using google libs before they officially started releasing in cocoapods. If all else fails, remove the pod entry from your Podfile and try adding the library manually.

Getting error when building in .xcodeproj - clang: error: linker command failed with exit code 1

I installed the braintree pod a long time ago in my .workspace project and tried to build my app in the .xcodeproj but am getting this error
ld: library not found for -lPayPalMobile
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Afterwards, the .workspace failed for the same reason. I have never had any problems building the app in the .workspace before this. I searched around for the solution, but nothing has worked so far.
I am not actually using braintree in my project and don't mind removing the framework altogether.
edit I tried updating the pod and got this message
[Debug]target overrides theFRAMEWORK_SEARCH_PATHSbuild setting
defined inPods/Target Support Files/Pods/Pods.debug.xcconfig'. This
can lead to problems with the CocoaPods installation
- Use the $(inherited) flag, or
- Remove the build settings from the target.
edit 2 I deleted the braintree pod and its working fine in the .workspace file, but now the .xcodeproj has this error
ld: library not found for -lPods-AFNetworking clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I searched the project and couldn't find there AFNetworking was (but in my command line it says that pod AFNetworking is being used)
A few things. One - Make sure you're only using one .xcworkspace at a time. Also, did you open .xcworkspace or .xcodeproj? Are you trying to build custom configurations? The only other thing I can think of is your schema containing spaces.

Resources