Cocoapods project settings issues - ios

I seem to have a issue with my project settings, in Xcode 8. The issue is as follows:
When adding a new Pod - lets say, Pod Firebase - the install works, and adds the necessary files to my project. I can then, do #Import Firebase
All is fine, up to this point. However, as soon as I make a reference to the Firebase API example: [FirApp configure]; - all is still fine - autocomplete on Xcode works as expected and no issues. However, when building I then get a compile time issue which states:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRAppIndexing", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The only way I am able to solve this - is by manually adding the _FIRAppIndexing.framework in my projects, Build settings, under Link Libraries with Libraries
To do that, I just drag and drop the frame work from the project navigator to the correct section under link libraries.
This works sometimes; as with other parts of the Firebase SDK, I get runtime crashes.
So, to try get to the root cause, I created a brand new test project, installed the Pods using Pod install - I however did not have to add the framework manually to Libraries - its actually not even listed there.
Everything in the test project worked just fine, at compile and run time.
Which leads me to believe its something in my project settings that's causing this.
Things I have tried
Removed cocoapods completely with pod deintegrate and removed all
other traces of it. Then did a clean build. Then Pod install
Added -objc to linker flag
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Crashlytics'
pod 'AsyncDisplayKit', '>= 2.0'
pod 'Firebase'
pod 'Firebase/Messaging'
pod 'FBSDKCoreKit'
pod "HockeySDK", :subspecs => ['AllFeaturesLib']
pod 'Fabric'
pod 'FirebaseAppIndexing'
pod 'AFNetworking', '~> 3.0'
pod '1PasswordExtension', '~> 1.8.4'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
GitHub example project
https://github.com/TanderZA/MyApp
I duplicated my current project - and removed all files. Problem still exists. You will see the project won't compile due to linker errors, with references to the Firebase AP.
By manually adding the frameworks to Link Libraries with Libraries, you will see that it should compile. But that is not how it should work. The current project has an issue with infoPlist.strings that I did not solve. But the project is in the state to demonstrate the issue.

I have checked the project, it seems you have messed up with schemes.
Create a new scheme properly then install the pods again and as the project is in Obj-C you don't need to enable frameworks in the podfile.
So comment like # use_frameworks!
Also update the pods using pod update
Then select the new scheme and build the project in it.
Let me know if you are not able to do it.

It is a xcode bug by the way
But try this :
Upgrade to latest version of xcode and Pods
Remove all architectures in your project
Clean your project
Add arcitectures from start.
This should resolve the issue.

Have you tried to use frameworks?
# platform :ios, '10.0'
use_frameworks!
target 'MyApp' do

I am not sure though but I think what you need is pod 'Firebase/Core'. not pod 'Firebase'.
This link have the list of the Firebase framework that can be used.
And, in the video on the top of the page it says something about there is no single pod that can be installed and you need to set each one of them on the podfile depending on the features you want.
My guess they mislead us in some places where they had pod 'Firebase'. I dont think that they meant that it should do the work.
som try the following:
# Pods for MyApp
pod 'Firebase/Core'
pod 'Firebase/Messaging'
.
.
I know that you said that you had it work on another new project.

Related

Framework not found GTMOAuth2

I keep getting this error when compiling an Xcode project and cannot for the life of me figure out what the issue is.
ld: framework not found GTMOAuth2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am working from an .xcworkspace with a Podfile that has:
use_frameworks!
pod 'Firebase', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Invites'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'TwitterKit'
pod 'GoogleSignIn'
pod 'GTMOAuth2'
amongst other things. It finds all of the platforms save GTMOAuth2. What is strange is that otherwise everything seems in order - I'm opening the correct xcworkspace and definitely not an xcodeproj
My Pods directory seems in order:
In my pods I see it as a target:
This should do it. Interestingly, when I add it as a Linked Framework and Library, it comes up gray...
Also, in the build directory, I see both:
/Build/Products/Release-iphonesimulator/GTMOAuth2/GTMOAuth2.framework
and
./Build/Products/Release-iphoneos/GTMOAuth2/GTMOAuth2.framework
but to no avail, GTMOAuth2 is not found. No clue how to proceed - any tips would be really helpful! I should mention that I'm new to iOS development and that the project is in the context of a React Native App.
-l"GTMOAuth2" Remove this line
then Compile:)
This worked for me
Go to Target -> Build Settings
Inside Framework Search Paths, delete the paths

Including a pod inside a framework target: file not found

I'm using framework targets (for better code reuse and IB_Designables), and I've already had a framework target working perfectly. I've decided to move some other classes to a framework target too.
I've set up the pods (just a single one in this case), but whenever I try to include the pod I'm getting not found error.
No change if I try to use the modules approach too:
The problem is that I've already got another framework too, with the same settings (cross checked all the compiler settings/linker flags/build phases etc) and that framework has no issue importing its pods.
Here is my podfile (TUComponents is the working on, TUModels is the failing one):
[...]
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
use_frameworks!
end
target 'TUModels' do
pod 'JSONModel'
use_frameworks!
end
Even weirder; Xcode has no problem code-completing importing the JSONModel/JSONModel.h header (or JSONModel in case of module #import). But when I try to compile, it fails.
What might be wrong with my configuration?
UPDATE: If I give up using frameworks in pods and use regular old static library, and set allow non-modular includes in frameworks to YES, I can build. But I have no idea why I can't build when using Pod frameworks.
Maybe try solution from: https://www.natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/
platform :ios, '9.0'
use_frameworks!
# My other pods
def testing_pods
pod 'JSONModel'
end
target 'TUComponents' do
pod 'AHKNavigationController'
pod 'TTTAttributedLabel'
testing_pods
end
target 'TUModels' do
testing_pods
end
From iOS - Build fails with CocoaPods cannot find header files :
Make sure your Podfile includes link_with on targets missing a config file. Cocoapods only sets the first target by default otherwise. e.g.
platform :osx, '10.7'
pod 'JSONKit', '~> 1.4'
link_with 'Pomo', 'Pomo Dev', 'Pomo Tests'
Restarting Xcode fixed it for me
The following steps worked in my case:
Quit the Xcode n Simulator
Delete Drived data
Again open your project
Clear it

ld: framework not found after pod install

I added Firebase libraries to my project, and then I got this error. When I compile it, Xcode can't find some directories. However, they are in the Pods directory.
Here is the error log:
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ToDoTogether' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
# Pods for ToDoTogether
end
Make sure you are opening the workspace file and not the project file. I was receiving the same error and realized I was using the project not the workspace.
I was facing same issue and I tried multiple things but still it was not working. I tried below.
Using XCworkspace file
Cleaned the project, restarted XCode, Mac
Turned bitcode to No
Deleted the search path for Framework, Library
Finally the thing that worked is, deleting pod file and re-creating pod file. It worked as magic!
P.S.: This is very generic error and so same solution may not work for all.
Go To Project Target > Build Settings:
Look for Search Paths > Framework Search Paths, delete all paths which you have been warned; then in Library Search Paths, delete all paths which you have been warned.
For me i had to change/edit the schema and choose the new one.
I had renamed my debug schema to debug(development) and that was causing my problem.
Fix:
Product > Edit Schema > Change Build Configuration
What I did was create alternate Configurations and renamed my current one.
In my case I just had to go to Edit Scheme > Run and Reselect "None" as Executable.

I'm getting framework not found <library> when installing with cocoapods

I installed Google Sign In via cocoapods, but when I tried to compile got this error
ld: framework not found GoogleAppUtilities
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
target 'Project_name' do
pod 'PayPal-iOS-SDK'
pod 'Google/SignIn'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Project_name
target 'Project_nameTests' do
inherit! :search_paths
# Pods for testing
end
target 'Project_nameUITests' do
inherit! :search_paths
# Pods for testing
end
end
I installed the PayPal library first without problem.
I'm using .xcworkspace
Tried cleaning and building again, using $pod deintegrate
clean the project and $pod init again and nothing seems to change.
In Xcode, look in the Pods project for a file named GoogleAppUtilities.framework. It's probably under the Pods/Products folder. You need to add a reference to this file (GoogleAppUtilities.framework) in your main project. In you main app project file go to the build settings tab and look at the list named "Link Binary with Libraries"...you need to add a reference here to the GoogleAppUtilities.framework file.
Just adding your comment as the solution: it worked for mee too:
Solved, I thank you. Your answer did not solve the issue, but It gave
me an idea. I did that and in Build
Settings->SearchPaths->FrameworkSearchPaths I added the framework in
Debug and Release.

xcode duplicate symbols for architecture error after updating cocoa pods

Here is my podFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Everythig has been working fine for a long time, but now, when I update my pods (pod update) these 3 pods get uptated:
AFNetworking
CocoaAsyncSocket
IQKeyboardManager
After that, nothing works anymore.
I get more than 600 duplicate symbols for architecture i386 errors, like this one:
duplicate symbol _OBJC_IVAR_$_AFHTTPRequestOperation._responseSerializer in:
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libPods-AFNetworking.a(AFHTTPRequestOperation.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libAFNetworking.a(AFHTTPRequestOperation.o)
... (661 times the same error but pointing to different duplicated files)
ld: 661 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas?
EDITED: After doing the solution shown below, my project only compiles for iPad Air and I can not Archive anymore, i still get the same error...
I use the 'Manually Rename All of the Symbols' approach. I was experiencing the duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods and so i added the post_install in the Podfile to avoid the duplicate symbol.
Replace your pod file content with this to 'Manually Rename All of the Symbols'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited), PodsDummy_Pods=SomeOtherNamePodsDummy_Pods'
end
end
end
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Edited :
Delete the following pod item's from your project
1.Pods Folder
2.Podfile.lock
3.ProjectName.xcworkspace
And then install the pods again
This hook allows you to make any last changes to the generated Xcode
project before it is written to disk or any other tasks you might
want to perform.
Reference -
1. https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/
2. http://guides.cocoapods.org/syntax/podfile.html#post_install
Even after deleting my pods and reinstalling them, I had always the same problem.
I finally found the solution by comparing with another project.
The issue was in the parameter "Other Linker Flags" (OTHER_LDFLAGS) in the Build Settings of the project. The pods were referenced not just by their name, but by adding the prefix "Pods-myProject"
"-l\"Pods-myProject-AMSlideMenu\"",
"-l\"Pods-myProject-CocoaLumberjack\"",
"-l\"Pods-myProject-DLAlertView\""
So I just removed the prefix and all was right
"-l\"AMSlideMenu\"",
"-l\"CocoaLumberjack\"",
"-l\"DLAlertView\""
I fixed a similar error (after a messy Cocoapods upgrade) by simply removing and then re-adding the pods. Backup your project, then run:
pod deintegrate
pod install
In my case we had a project written in objective C and swift with a custom framework module inside and to solve the symbols duplication problem we had to remove all the flags from Other Linker Flags under Build Settings of the project and the framework module.
Before inside Build Settings:
OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-all_load" );
After inside Build Settings:
OTHER_LDFLAGS = "$(inherited)";
I think Cocoapods has a bug where pod source files can be accidentally duplicated.
My project was building fine until after performing one pod update at which point a duplicate symbol error appeared.
After lots of confusion, I finally noticed that a Google pod ended up with two files. In my case, it was GTMOAuth2SignIn.m and GTMOAuth2SignIn 2.m. Hence, the duplicate symbol error.
Note that pods seem to reference files by wildcards indicating all source in a directory should be included. This differs from a classic Xcode project where files are explicitly referenced.
Also, I suspect that performing a pod update during a build process could be what's tripping up Cocoapods. The concurrent access to the same file(s) may cause problems. Just a theory.
Also, this may explain why some "solutions" associated with this problem are to remove/delete referenced pods, then re-add.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag the offending repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.

Resources