可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
回答1:
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.
回答2:
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.
回答3:
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).
回答4:
Add -lGoogleAnalyticsServices in Build settings -> Other Linker Flags
回答5:
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
回答6:
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.
回答7:
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.
回答8:
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.
回答9:
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.
回答10:
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>
回答11:
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.