Contradicting frameworks on -ObjC - ios

So in my project I have the FacebookSDK, the ParseSDK and FirebaseSDK. Facebook and parse both need bolts, so I implemented that. However it will not compile unless I remove the -ObjC flag. The problem is that if I remove this tag, the code will compile, but It will cause a runtime error when trying to initialise Firebase because it requires -ObjC. I am in a mess. Can I set the flag only for that specific framework? Thanks for any help.

( I think this should be a comment, but I don't have enough rep yet, hope this helps to solve this.)
I'm having the exact same problem (with SponsorPay SDK instead of FirebaseSDK), Facebook SDK & Parse work fine together until i add the -ObjC flag, needed by SponsorPay to work.
Deleting Bolts.framework is not the solution, since that gives some linking errors:
"_BFTaskMultipleExceptionsException", referenced from:
___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)
___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get the exact same error if I use the Bolts.framework included in the FacebookSDK package.
But, using the Bolts.framework included in the Parse Library I got a different error:
ld: 91 duplicate symbols for architecture x86_64
All frameworks and libraries are updated.
EDIT:
Using cocoapods solved the problem for me too!

See: FacebookSDK and Bolts conflicting each other (duplicate symbols) on build.
I would suspect that Facebook is broken, and is including bolts itself. No thirdparty framework should include another thirdparty framework, since it leads to exactly this. All third-party frameworks should be linked at the final application stage. Go into any frameworks that link their own sub-libraries, and remove the sub-sublibraries (and open bugs against the offenders).

Related

Trouble adding -ObjC flag to iOS project

I have an iOS project which includes the Parse library. It has been working fine.
Today, I needed to add the Google Conversion Tracking SDK to my project. The instructions for adding this SDK require that I change my project settings to include the -ObjC linker flag.
When I did this, I could no longer compile my project. The errors I receive are of the form "Undefined symbols for architecture x86_64", and in every case the source of the error is something in the Parse SDK. Here is one example of the 6 errors I'm getting:
Undefined symbols for architecture x86_64:
"_ACAccountTypeIdentifierTwitter", referenced from:
-[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
I've never had to use the -ObjC flag explicitly before. My understanding is that this flag tells the compiler to link every class that was compiled even if it isn't explicitly referenced in the source code. Other than producing a larger executable, I can't see how this would cause a problem.
Appreciate any solutions or ideas.
Thanks.
I recently had a similar issue (not with parse though).
Open PF_Twitter and see what frameworks are included in it's header and implementation files. Then go to your target's Build Phases and add those frameworks in "Link Binary With Libraries".
If this doesn't help, other alternatives are discussed under this stack overflow question--
Undefined symbols for architecture arm64 Parse
Thanks. Adding the Social framework fixed the problem for me.

Conflicting libraries in iOS project

So basically I have two libraries that are I think conflicting with each other. I have the following settings for the key "Library Search path":
"$(SRCROOT)/projectname/Release-iphone/lib" for one of my libraries, and "$(SRCROOT)/projectname" for another.
I have added a CorePlot library into my project but to work it requires the following Linker Flags: -ObjC -all_load.
Now when I add one or both of them I get the following message and my project won't build:
duplicate symbol _OBJC_CLASS_$_GTMHTTPFetcher in:
/Users/user/Library/Developer/Xcode/DerivedData/projectname-chibchblpntaapfagqcohtkixhib/Build/Intermediates/projectname.build/Debug-iphoneos/projectname.build/Objects-normal/armv7/GTMHTTPFetcher.o
/Users/user/Dropbox/Projectname/projectname/projectname/libGTLTouchStaticLib.a(GTMHTTPFetcher.o)
duplicate symbol _OBJC_METACLASS_$_GTMHTTPFetcher in:
/Users/user/Library/Developer/Xcode/DerivedData/projectname-chibchblpntaapfagqcohtkixhib/Build/Intermediates/projectname.build/Debug-iphoneos/projectname.build/Objects-normal/armv7/GTMHTTPFetcher.o
/Users/user/Dropbox/Projectname/projectname/projectname/libGTLTouchStaticLib.a(GTMHTTPFetcher.o)
ld: 176 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The problem turns out to be with the Google API library libGTLTouchStaticLib.a but I don't get how do linker flags influence it.
It looks as though you have the source file included directly into your project as well as having a link to the library. You should choose one or the other (probably the library).
screw -all_load that was a hack to load categories. should work without it

Xcode gives Apple Mach-O linker error

I just compiled a project and Xcode returns these two errors which don't seem to be my code's fault. How do I fix them?
Undefined symbols for architecture i386:
"_vImageBoxConvolve_ARGB8888", referenced from:
-[UIImage(Blur) boxblurImageWithBlur:] in UIImage+Blur.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Teaching a man (or women) how to fish:
Usually Mach-O Linker Error means you have not included a header file for a function you are using in your code.
Easiest way is to copy that function or method call and paste into Xcode quick search using shift+command+O. This will search all frameworks (and header files), find that function or method call and show you its location (the header in this case):
In this case, this call belongs to the Accelerate framework so on top of your file, enter:
#import <Accelerate/Accelerate.h>
When doing quick search, you might have to get rid of leading underscore. In other words, search for vImageBoxConvolve_ARGB8888
Hope this helps
Google is your friend: someone else fixed this by adding the Accelerate framework to their project (and this does look like a framework error).
https://github.com/rnystrom/RNBlurModalView/issues/5
Make sure you also have the QuartzCore framework included as well, as that is also required by that library.
Apparently vImageBoxConvolve_ARGB8888() is not defined. See if the Accelerate framework is properly included in the project.

Google Analytics Library IOS

When i add google analytics library, i have this warning
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalytics.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalytics.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
l003 in libGoogleAnalytics.a(GAIDataStore.o)
Please help me
Add libGoogleAnalytics.a to your target setting [Build phases]-[Link Binary with Libraries]. Also check if libsqlite3.0dylib (where GA stores tracking data) and CFNetwork.framework are added there as they are required for Google Analytics/iOS (version 2.0 beta 3).
P.S. For Google Analytics/iOS version 3.0 CoreData framework is required instead.
I had have the same issue on NSAttributeDescription. In documentation this function is from CoreData.framework, so I have added this framework and no more errors on that issue.
Problem related to Google Analytics SDK for iOS v2 migration.
I am not sure which topic to write it to as there is no exact problem--I've bumped into and solved by my own--found (this one seems to be the closest (not sure if I should open a new one)), but might be helpfull for someone.
Problem:
I have my previous (1.5.1) SDK installed in "SDKs/GoogleAnalytics SDK" separate folder. On v2 migration I've placed the new files into "SDKs/GoogleAnalytics SDK v2". After following all the instructions about migration (from Google site) (and, in details, that was just removing the previous references to the files from the first folder and adding the new ones from the new one), I started to get the following error message on compilation:
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_GAI",
referenced from:
objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code
1 (use -v to see invocation)
I went trough first pages of googling (and stackoverflowing) and the most popular solution suggested was "to set 'Build active architecture only' property to 'YES'" (my active architectures are "armv7 armv7s"). But that DID NOT HELP at all.
Solution:
However, a miracle happened. I've noticed that there is an old directory "SDKs/GoogleAnalytics SDK" was listed in linker pathes. So, after that directory removing (as I don't know where the list of the directories exists in settings) everything started to compile and work like a charm (also setting 'Build active architecture only' to 'YES' was not necessary for me).
Add -lGoogleAnalyticsServices in Build settings -> Other Linker Flags
I had similar errors as above, actually more (SDK 2.0 beta 4). After adding the Analytics library/headers, linking with these two frameworks solved the issues:
CoreData.framework and SystemConfiguration.framework
I followed this tutorial. It says to add
#import "GAI.h"
#import "GAIFields.h"
into the NameofTheProject-Prefix.pch file.
And additionally to CoreData.framework and SystemConfiguration.framework add libz.dylib
It solved all issues.
I was having this issue because i didn't add the libGoogleAnalytics_debug.a file. The problem just got resolved as i added this file and built the project again.
I had an ODD odd issue. For some reason libGoogleAnalytics.a was in Copy Bundle Resources when it was supposed to be in Link Binary With Libraries
Hopefully that helps someone.
Had similar issue after migrating to SDK 2.0 beta 4. Resolved by removing old GA library path from My Build Settings > Library Search Paths as pointed by Adri.
If using Cocoapods make sure Other linker flags has only $(inherited) flag and remove any child architecture flags.
For framework search paths and Library search paths also set only $(inherited) flag.
Inside the header bridging file put the #import <Google/Analytics.h>
I followed all suggestions and I was still getting an error on XCODE 5.1.1.
For me the error was in target > Build Setting > Architecture > Architectures.
I replaced the value with ARCHS_STANDARD_32_BIT and the error was gone.
Maybe the libGoogleAnalytics lib was not compiled for 64 BIT architecture.
Hope this will help someone. Or get latest lib which is compiled for 64 Bit.

Problems adding Google Analytics to iOS App

When I run through implementing Google Analytics in my app, using this walk through:
http://code.google.com/mobile/articles/analytics_end_to_end.html
After adding the libGoogleAnalytics.a CFNetwork and libsqlite3.0.dylib frameworks, and added the GANTracker.h into my AppDelegate.m
I get this error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GANTracker", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and the app won't even compile. My app is aimed at iOS 5.0
I'm pretty stuck. Any advice or work throughs would be very highly appreciated.
I actually figured out the answer after posting the comment.
Click on your project in the "Project Navigator", then click on your project under "Targets". You then need to click on "Build Phases". You need to make sure libsqlite3.0dylib and CFNetwork.framework are added to the "Link Binary WIth Libraries". I had this, but what I didnt have was you also need to add libGoogleAnalytics.a to that same area. That fixed the problem for me.
In my case, I add the AdSupport.framework for the missing "_OBJC_CLASS_$_ASIdentifierManager"
Just adding to the answer of #Etch.
Xcode 4.5 dropped armv6 and only supports armv7. Therefore, your lib might be an old version and you need to download version 1.5.1 onward. Download here
Issues: http://code.google.com/p/analytics-issues/issues/detail?id=232
I was working on a Cordova based XCode project. And got stuck with these stupid errors before figuring out what the linking errors meant. So here is what you do..
First, make sure you follow the steps mentioned https://github.com/phonegap/phonegap-plugins/tree/master/iOS/GoogleAnalytics. Next make sure you have the following files under the project linked via Build Phases (You get that when you click on the project name.. figure it out)
GANTracker.h
libsqlite3.0.dylib
libGoogleAnalytics.a
CFNetwork.framework
Also make sure your Plugins folder has 2 files, GoogleAnalyticsPlugin.h and GoogleAnalyticsPlugin.m.
If that doesn't help resolve your bugs. Then God help you. Start praying. Or alternatively try a bug spray. See if that works.
I had the same issue. The solution was move the library to same level of .h files.
But I don't know why this work.
In your Link Binary With Libraries under Build Phases under your target:
Make sure you remove libGoogleAnalytics_debug.a if you added it. And ensure you have AdSupport.framework and of course libGoogleAnalyticsServices.a.

Resources