How to add spotify framework to an custom pod - xcode

I try to add the Spotify framework to my custom cocoaPod project but i got an error :
ld: framework not found Spotify
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i added the framework in the Build Phases of project and the search Path to.
but can't build.
Any one can help me please.
Sorry for my bad english.

Are you following some kind of tutorial for this? This shouldn't be an issue with Cocoapods, unless I'm misunderstanding something.
Make sure you clean your project first. I would remove the work you did in Build Phases, the intention of Cocoapods is to avoid adding frameworks manually as an embedded dependency.
Before a pod install, close your project. Pod install and then open up your workspace file once complete, not your xcodeproject file. Try building now. Build again with your imported pod statement. Please update if you need help further.

Related

How can I solve XCode 12 build error with Parse SDK?

I just downloaded XCode 12.2 and created new empty project.
Then I imported Parse SDK with pod.
The problem is that the project doesn't build.
errors found:
framework not found Parse
ld: framework not found Parse
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I solve it?
I was having a similar issue and tried a dozen different fixes. The one that seemingly worked was to update the Podfile to install Parse directly from GitHub.
I changed pod 'Parse' to pod 'Parse', :git => 'https://github.com/parse-community/Parse-SDK-iOS-OSX.git'
I say "Seemingly" because some of my other fixes may have contributed to its success.
Which version of the Parse SDK are you using? Can you share the contents of your Podfile?
Did you open the xcworkspace file instead of the xcodeproj?
I just installed Parse 1.18.0 using Cocoapods and it is working normally.

Cocoa Pods without workspace?

I have read about a possibility to add CocoaPods to an XcodeProject without getting the xcworkspace file, instead you get a xcodeproj file that you can integrate into your current project. How can I do that? Would love to use the xcodeproj file instead of xcworkspace.. I'm programming in swift (if that makes any difference).
Yes, its possible. But, we need to do few steps to proceed.
Check this Github thread.
The below line in pod.file will not let the client integration process.
install! 'cocoapods', :integrate_targets => false
We can drag and drop the Pods.xcodeproj to the main project
Link the target dependencies and Link Binary with Libraries in Build phases.
Thats it.
You can not do this.
The CocoaPods website guide to using CocoaPods found here directs you to using the .xcworkspace it creates. Several other guides found across the Internet all direct you to use this file indicating that using the .xcodeproj file will now result in build errors.
There is simply no evidence that this is a possibility at all.
From the CocoaPods website guide on using CocoaPods:
Save your Podfile.
Run $ pod install
Open the MyApp.xcworkspace that was created. This should be the file you use everyday to create your app.
More from their website:
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
And from the Ray Wenderlich guide regarding using CocoaPods with Swift:
Open the project folder using Finder, and you’ll see that CocoaPods
created a new IceCreamShop.xcworkspace file and a Pods folder in which
to store all the project’s dependencies.
And from an NSHipster article on CocoaPods:
CocoaPods will create a new Xcode project that creates static library
targets for each dependency, and then links them all together into a
libPods.a target. This static library becomes a dependency for your
original application target. An xcworkspace file is created, and
should be used from that point onward. This allows the original
xcodeproj file to remain unchanged.
In older versions of cocoapods it was possible to install and update pods with the option '--no-integrate'. It allows you to create a library project, which could be imported into an existing project (read more). But this option is missing now. I've build a Xcode project for a maven-build with this option earlier. Today I've updated the pods of this project with the newest cocoapods version (1.0.0) but without the '--no-integrate' option and it still works. So eventually there is a way...

Xcode: ld: library not found for -lAFNetworking

Because of this one reason, build always fails...Any ideas about what I could try?
EDIT: the solution is to open the xcworkspace instead of the xcproject!
Might be you are opening .xcodeproj file after installing pods. Close the project and open .xcworkspace file.
Have the same issue.
What I did with the help of https://premium.wpmudev.org/forums/topic/anybody-solved-this-linker-command-failed-with-exit-code-1 and Adlair Cerecedo-Mendez
Delete the "Pods" project on the left panel of Xcode.
Close Xcode and delete this file in the finder too.
Install pods again.
Open Xcode and clean.
Verify that the build option "Build Active Architecture Only" is set to "NO" for your project but also for your Pods project (selection with left panel).
Click on your project Scheme (top, near the stop button) and "Manage Scheme".
Check, select all your pods libraries and close.
Then, for all libs, select them (scroll the list) and build manually for the selected architecture.
Every time you change your architecture (simulator, device or for archive(Generic iOS Device)) you must do the above step: namely, manually build each libraries by selecting them in your scroll list one by one, and only than build and run your main project.
Seems a bit WTF, but it is the only way I resolve this issue...
I Had this Issue several Times with PODS Libraries.
Here is something you can Try:
Run pod cache clean --all and pod install again.
Check your Header Search Paths and Library Search Paths, Remove all entries and place $(PROJECT_DIR) in recursive mode and $(inherited) as a Second Entry
Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.
Make sure Build Active Architecture Only is set to NO in the Pods project settings.
I'm thinking on two possibilities:
1) Install cocoapods-deintegrate project:
$ gem install cocoapods-deintegrate
Then run $ pod deintegrate, after that run $ pod install again. If it not works, then...
2) You can try open your Pods project and create new scheme for the target that you need, in this case for AFNetworking.
When the static library is created, then add it to your Frameworks references into your main project.
Hope that helps.
I have in project->TARGETS->Build Phases ->Link Binary With Libraries one "extra" framework that remains from recent project. Delate it and all run smoothly
Had a similar issue ... took a while to realize that I had updated my app's "iOS Deployment Target" to iOS 9.0, but the Pods project's "iOS Deployment Target" was still iOS 8.0!!!
I encountered this error when I downloaded some code from github. I tried to build .xcodeproj file but it failed giving the library not found error. I then opened .xcworkspace file and build that file first by clicking Product -> Build for -> Running. The workspace file built fine with no errors. Then in workspace file I changed scheme to the xcode project I was trying to build, and clicked Product -> Run. The app got built and ran with no errors.
I had this issue while using fastlane with a ReactNative project. I had added a dependency that required cocoapods.
My Fastfile looked like this:
...
gym(
scheme: "AppName",
project: "./ios/AppName.xcodeproj"
)
....
And had to change it to the workspace like this:
...
gym(
scheme: "AppName",
workspace: "./ios/AppName.xcworkspace"
)
...
For me all this thing not help. Only delete in Build settings project.
open xcode, from the top left select the pod library that is being shown as not found.Use 'Command B' to build this pod, then again select your target scheme and run.
For me this fixed it.
Use the xcworkspace to build instead of the xcproject?
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.

library not found for -lBaiduMapApi

I use cocoaPods in my current project.
Because the 'Baidu map iOS SDK' don't have a pod spec so I just create one.
The 'Baidu map iOS SDK' use a '.a' static library and some header files, I add them into my project through cocoaPods
But when I build my project, it always has an error:
ld: library not found for -lBaiduMapApi
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I google it then I try to set the Library Path in Xcode.
Both in my project and the target in Pods.
I am sure the path is correct, but the error still there.
Can somebody help me?
It's weird......
I remove whole my project and Recreate a new one.
And config the Podfile, update .....
When I back to the Xcode, build, Success!!!
I can find another way to solve this problems

Link error attempting to build app with Cocoapods using xcodebuild on Jenkins

I'm trying to set up a Jenkins CI instance for our app development project. I have jobs working that run logic and application tests using the Debug configuration but I'm struggling to build the IPA as I get a linkage error during compilation.
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The app uses Cocoapods and I'm building with the Jenkins XCode plugin.
I searched for similar problems and tried/verified a bunch of things:
I am using a workspace.
I'm running pod install before the xcodebuild step.
I've checked that architectures on the project itself, the target and Pods are the same – standard (armv7, armv7s) – as suggested by this answer
I tried various solutions from this GitHub thread
I tried various settings for Derived Data locations as per this answer and similar ones
The Podfile specifies platform :ios, :deployment_target => "6.0"
At that point I'm at a loss for what more to try.
The 'Build Output Directory' setting can also cause this.
Changing the value of the 'Build Output Directory' from a relative path to a fully specified path fixed it for me.
E.g. instead of 'MyOutputDirectory' use '/Users/Shared/Jenkins/home/jobs/JenkinsProject/workspace/MyOutputDirectory'
The problem might be because you have different (custom) build configurations.
Take a look at this:
https://github.com/CocoaPods/CocoaPods/issues/121
Try adding following search path to "Library Search Paths" (For all configs)
$(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
You can try choose your Pods project and set Build Settings->Build Active Architectures Only->NO for Release and Debug, repeat this action for each target in Pods.
I can't speak to the XCode plugin, so my answer may be considered somewhat unresponsive, but here is how I got it working.
I added a build step that looks like this:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
echo $WORKSPACE
cd "/Users/[jenkins-accountname]/.jenkins/jobs/[jobname]/workspace/[xcode project name]"
pod install
xcrun xcodebuild -workspace [your workspace (not project) name] -scheme [the build scheme to build] clean build -destination "platform=iOS,name=CurtsiPhone" -destination-timeout 120
The -destination and -destination-timeout were key build arguments for success. My project will only build on the phone since it uses specialized libraries, so my phone has to be plugged in so the XCode can find it. You may not need this if your project will build in the simulator, however I only got it working when I explicitly specified a destination.
If the XCode plugin allows you to state extra compile arguments, you should try these.
If you're using XCode 5 then I think this should help
basically update your Gemfile (or create one if it doesn't exist) and add:
gem 'cocoapods', :git => 'http://github.com/CocoaPods/CocoaPods', :branch => 'xcode-5-support'
gem 'xcodeproj', :git => 'http://github.com/CocoaPods/Xcodeproj', :branch => 'redacted-support'
Also if you have things like config.build_settings['ARCHS'] = 'armv7' in your Podfile, don't forget to get rid of it, you'll need to have armv7s too.
Hope this helps, cause it saved me a few days of nightmare.

Resources