CocoaPods Google Analytics .xcworkspace and .xcodeproj files - ios

I have an error in .xcodeproj:
ld: framework not found Pods (null): Linker command failed with exit
code 1 (use -v to see invocation)
I found the mistake the pod install folder was good, but I have to build the .xcworkspace, but I don't know why they're the error on .xcodeproj, and if it can be a problem on application deployment someone know why they're the error ? How to hide this error ?

Follow this steps:
Make sure close all Xcode Projects. (.xcworkspace and .xcproject) (sometimes .xcproject still open)
Run pod install and pod update
Open the ProjectName.xcworkspace
Clean and Build your Project
After that you should be able to run normally.

As cocoapods states when you setup cocoapods in your projects the first time, you need to use xcworkspace from now on. You can't work on xcodeproj directly. This is because it needs to have both Pods and your app project open at the same time.
Just close your xcodeproj and never open it again. Always open the xcworkspace and always work from there as long as you are using cocoapods in your project.

Related

Yet another Linker command failed with exit code 1

I built an app 2 months ago and now I want to work with it again. I opened up the project today and I am getting the error as follows:
Linker command failed with exit code 1
Why do I get this error?
build fail
pod folder
The linker error is because you can't find pods. Try the following:
Close Xcode
pod install
Open workspace
If that doesn't work:
Close Xcode
pod update
Open workspace
If that still doesn't work:
Close Xcode
Delete derived data
Delete Pods folder and Podfile.lock
pod update
Open workspace
If that STILL doesn't work... it could be your project's deployment target, make sure the targetted version is the same in both your project and the podfile.
As the picture say, can't find the pods. Just simply reinstall them with pod update. And ofcourse, don't forget to use .xworkspace files.

Xcode /Podfile.lock: No such file

I am trying to run an ionic app on xcode. But xcode throws an apple match-o linker error. I get this error, when I get this after I have runned the following command:
cordova plugin add phonegap-plugin-push --variable SENDER_ID=5****** --save
I need this plugin, for push notifications. After a research on google, I founded that I need to have Cocoapods installed in the projects. But after installing Cocoapods & pod install. I get the following error, when I start the "project.xcworkspace".
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I tried to rebuild/clean project or install pod again. But it did not fixed for me.
Can someone help me?
EDIT -> new Error
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am getting this error, when i have fixed the error with pods.
If you are setting up environment setup in your project, you have to choose corresponding pods target in configuration.
Update your CocoaPods installation first ("sudo gem install cocoapods")
then remove everything related to POD from project directory except .podfile.
Run "pod install" on terminal and open your project using workspace file.
1- Remove PODS folder from project folder and then perform pod install and open project using .xcworkspace file.
If above one don't work, go to Xcode Build phase and check for path in scripts added by PODS(usually with pods word in there title), sometimes for hybrid project the path was not correct for podfile.lock and manifest.lock file lookup in the script.
Easiest Solution which worked for me:
Open terminal inside your project directory
Change directory to 'ios' (cd ios)
Type 'pod install' and wait for dependencies getting downloaded and installed
I hope this will help someone out!
In my case, I updated cocoapods and the problem was solved.
gem install cocoapods --user-install
My case, Please:
Xcode → File → Workspace Settings.
Make sure in tag: Build System → New Build System.
Please copy your Podfile.
Delete Podfile, Podfile.lock, Pods Folder in your root app folder, like this.
Next Step, Open <YourProject>.xcodeproj. You should use Terminal by:
open <YourProject>.xcodeproj. (Remember not .xcworkspace)
In Pods tag, delete these files, like this:
<Pods-YOURPROJECT>.debug.xcconfig
<Pods-YOURPROJECT>.release.xcconfig
Pod init and Pod install your Project again.
Open <YOUR PROJECT>.xcworkspace, with Terminal: open YOURPROJECT.xcodeproj
CMD+SHIFT+K to clean build.
CMD+B to build again.
Enjoy
Last year I had used the similar plugin, when I was working on an App Update, I came to know that this plugin got deprecated. Not sure about the above one.
So I've working using FCM. I had the similar problem while working with FCM. After having spent nearly a day on researching on this I've found a cordova plugin which takes care of pods in cordova.
Plugin name:
cordova plugin add cordova-plugin-cocoapod-support --save
Please Note: After installing this plugin, there's no need of podinit, or opening the pod and installing it. This plugin will take care of it. It will create a AppDelegate inside the plugin folder where it will handle everything - you can retrieve Push Token as well in DEV mode if you wish.
After I installed this plugin and build iOS, there were no issues.
** Note **
Please ensure while working with FCM, no other google plugins are installed, they'll conflict. Earlier I had GoogleAnalytics plugin, as it's now covers within FCM - you can remove Old GoogleAnalytics plugin in order to work with FCM without issues.
For my Cordova project doing pod init in the ios folder fixed the issue.
From your Cordova project root directory you would:
cd /platforms/ios
pod init
cd ../../
cordova build ios

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.

How do I resolve the linker command error?

I installed the Stripe pod into my project, and it was working, but now it decided to stop working. I keep getting this error. What does it mean, and how do I fix it?
Library not found for -IAFNetworking Linker
Linker command failed with exit code 1 (use -v to see invocation)
You must use the new <YourProject>.xcworkspace instead of <YourProject>.xcodeproj.
The xcworkspace contains your project and your pods.
You also can follow this steps:
Uninstall the App from Device or Simulator.
Make sure close all Xcode Projects. (.xcworkspace and .xcproject) (sometimes .xcproject still open)
Run pod install and pod update
Open the .xcworkspace
Clean and Build your Project
After that you should be able to run normally.

library not found for -lPods from GitHub project

I am getting the following error when trying to build a project I found on GitHub.
ld: library not found for -lPod
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've heard of some people saying to use the workspace file instead of the workspace file but there is no project file.
Here is the project
My app can run on simulator but can't run on device.
I fixed this by these steps.
The Pods Xcode project now sets the ONLY_ACTIVE_ARCH build setting to YES in the Debug configuration. You will have to set the same on your project/target, otherwise the build will fail.
Ensure your project/target has an ARCHS value set, otherwise the build will fail.
When building a iOS project from the command-line, with the xcodebuild tool that comes with Xcode 4, you’ll need to completely disable this setting by appending to your build command: ONLY_ACTIVE_ARCH=NO.
http://guides.cocoapods.org/using/troubleshooting.html
All my pods project have debug build only active architecture to YES(from pod install), but my project set to NO. So, I change it to YES, then it's work.
This project uses Cocoapods to manage its third party dependencies. Whilst the developer has committed the Pods/ directory, it's probably best to install the Pods yourself:
Install Cocoapods if you don't already have it: sudo gem install cocoapods
cd into the top level project directory, and install the required Pods for this project: pod install
Open the TestOCR.xcworkspace that will be created.
Build and run.
I got it working, all I had to do was simply drag the Pods.xcodeproj into the TestOCR.xcodeproj thanks for the help.
I have encountered this issue couple of times and the common fix is to simply build the Pods target.
The project seems to have bad CocoaPods configuration (or not at all). There is no workspace and no Podfile (which is even worse, because if there's a Podfile you can install CocoaPods by your own and update pods).
You can look into Pods directory and try to create Podfile from scratch (depending on found libraries) and the install CocoaPods. This should work.

Resources