Linking Xcode iOS project with OCMock using cocoaPod - ios

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?

Related

Cocoapods linker error when running app from Xcode project

I tried installing some Cocoapods based on some instructions online and the whole process went as described. But I now get an error:
ld: framework not found Pods_Happ
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried installing a pod called "WCLShineButton". I think it has something to do with my app's framework because the "Pods_Happ.framework" is red:
Pods_Happ.framework red
Close the .xcodeproj file and open the .xcworkspace file in Xcode instead.
CocoaPods wraps your Xcode project (.xcodeproj) into an Xcode workspace. After that you should always work with the workspace instead of the project.

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

How to remove all references to a library?

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!

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.

Quickblox simple chat app

ld: warning: directory not found for option '-F/Users/igorkhomenko/workspace/quickblox-ios-sdk/Framework'
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am new to ios development and quickblox
I get this kind of error..what it is about ? M i missing to add some file .
you seem to have used cocoapods to add this library to your project.
Cocoapods creates, and requires you to use, an xcworkspace file to manage your Xcode project.
This is an error that occurs when you are still using the xcodeproj file instead of the xcworkspace.
Either that or your cocoa pods setup is broken. Try running pod install again or see the website to fix it.
Did you add the quicklblox library through Target Settings -> Build Phases -> Link binary with libraries -> + button?

Resources