我最近升级到iOS4 SDK,我的应用程序不再编译模拟器,但 为设备编译。
这是由于第三方库 libGoogleAnalytics.a 。解决方案似乎是谷歌发布了一个符合新SDK的新静态库,遗憾的是没有任何发布日期,并且由于新的SDK许可,他们可能永远不会发布新的库。
http://www.google.com/support/forum/p/Google+Analytics/thread?tid=0e35876711dc99b1&hl=en
我收到以下编译错误:
Undefined symbols:
".objc_class_name_NSObject", referenced from:
.objc_class_name_GANTCPSocket in libGoogleAnalytics.a(GANTCPSocket.o)
.objc_class_name_GTMLogger in libGoogleAnalytics.a(GTMLogger.o)
.objc_class_name_GTMLogBasicFormatter in libGoogleAnalytics.a(GTMLogger.o)
.objc_class_name_GTMLogLevelFilter in libGoogleAnalytics.a(GTMLogger.o)
.objc_class_name_GTMLogNoFilter in libGoogleAnalytics.a(GTMLogger.o)
.objc_class_name_GTMLogASLWriter in libGoogleAnalytics.a(GTMLogger+ASL.o)
.objc_class_name_GTMLoggerASLClient in libGoogleAnalytics.a(GTMLogger+ASL.o)
.objc_class_name_GANDataDispatcher in libGoogleAnalytics.a(GANDataDispatcher.o)
.objc_class_name_GANHTTPResponseParser in libGoogleAnalytics.a(GANHTTPResponseParser.o)
.objc_class_name_GANEvent in libGoogleAnalytics.a(GANEvent.o)
.objc_class_name_GTMLoggerRingBufferWriter in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
.objc_class_name_GANTracker in libGoogleAnalytics.a(GANTracker.o)
.objc_class_name_GANPersistentEventStore in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_NSFileManager", referenced from:
literal-pointer@__OBJC@__cls_refs@NSFileManager in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_NSString", referenced from:
literal-pointer@__OBJC@__cls_refs@NSString in libGoogleAnalytics.a(GTMLogger.o)
literal-pointer@__OBJC@__cls_refs@NSString in libGoogleAnalytics.a(GANTracker.o)
literal-pointer@__OBJC@__cls_refs@NSString in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_NSError", referenced from:
literal-pointer@__OBJC@__cls_refs@NSError in libGoogleAnalytics.a(GANTracker.o)
literal-pointer@__OBJC@__cls_refs@NSError in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_NSFileHandle", referenced from:
literal-pointer@__OBJC@__cls_refs@NSFileHandle in libGoogleAnalytics.a(GTMLogger.o)
".objc_class_name_NSMutableString", referenced from:
literal-pointer@__OBJC@__cls_refs@NSMutableString in libGoogleAnalytics.a(GANDataDispatcher.o)
".objc_class_name_NSTimer", referenced from:
literal-pointer@__OBJC@__cls_refs@NSTimer in libGoogleAnalytics.a(GANTracker.o)
".objc_class_name_NSMutableArray", referenced from:
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libGoogleAnalytics.a(GANDataDispatcher.o)
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_UIScreen", referenced from:
literal-pointer@__OBJC@__cls_refs@UIScreen in libGoogleAnalytics.a(GANDataDispatcher.o)
".objc_class_name_NSProcessInfo", referenced from:
literal-pointer@__OBJC@__cls_refs@NSProcessInfo in libGoogleAnalytics.a(GTMLogger.o)
"_objc_exception_extract", referenced from:
+[GTMLogger sharedLogger] in libGoogleAnalytics.a(GTMLogger.o)
+[GTMLogger setSharedLogger:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setWriter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFormatter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFilter:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSFileHandle(GTMFileHandleLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSArray(GTMArrayCompositeLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogStandardFormatter stringForFunc:withFormat:valist:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLoggerRingBufferWriter count] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter droppedLogCount] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter reset] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter dumpContents] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter logMessage:level:] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
+[GANTracker sharedTracker] in libGoogleAnalytics.a(GANTracker.o)
+[GANTracker allocWithZone:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker startTrackerWithAccountID:dispatchPeriod:delegate:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackPageview:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackEvent:action:label:value:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker stopTracker] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker dispatch] in libGoogleAnalytics.a(GANTracker.o)
".objc_class_name_NSDate", referenced from:
literal-pointer@__OBJC@__cls_refs@NSDate in libGoogleAnalytics.a(GTMLogger.o)
literal-pointer@__OBJC@__cls_refs@NSDate in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_UIDevice", referenced from:
literal-pointer@__OBJC@__cls_refs@UIDevice in libGoogleAnalytics.a(GANDataDispatcher.o)
"_objc_exception_try_exit", referenced from:
+[GTMLogger sharedLogger] in libGoogleAnalytics.a(GTMLogger.o)
+[GTMLogger setSharedLogger:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setWriter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFormatter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFilter:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSFileHandle(GTMFileHandleLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSArray(GTMArrayCompositeLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogStandardFormatter stringForFunc:withFormat:valist:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLoggerRingBufferWriter count] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter droppedLogCount] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter reset] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter dumpContents] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter logMessage:level:] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
+[GANTracker sharedTracker] in libGoogleAnalytics.a(GANTracker.o)
+[GANTracker allocWithZone:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker startTrackerWithAccountID:dispatchPeriod:delegate:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackPageview:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackEvent:action:label:value:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker stopTracker] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker dispatch] in libGoogleAnalytics.a(GANTracker.o)
".objc_class_name_NSDateFormatter", referenced from:
literal-pointer@__OBJC@__cls_refs@NSDateFormatter in libGoogleAnalytics.a(GTMLogger.o)
"_objc_exception_try_enter", referenced from:
+[GTMLogger sharedLogger] in libGoogleAnalytics.a(GTMLogger.o)
+[GTMLogger setSharedLogger:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setWriter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFormatter:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogger setFilter:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSFileHandle(GTMFileHandleLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[NSArray(GTMArrayCompositeLogWriter) logMessage:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLogStandardFormatter stringForFunc:withFormat:valist:level:] in libGoogleAnalytics.a(GTMLogger.o)
-[GTMLoggerRingBufferWriter count] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter droppedLogCount] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter reset] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter dumpContents] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
-[GTMLoggerRingBufferWriter logMessage:level:] in libGoogleAnalytics.a(GTMLoggerRingBufferWriter.o)
+[GANTracker sharedTracker] in libGoogleAnalytics.a(GANTracker.o)
+[GANTracker allocWithZone:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker startTrackerWithAccountID:dispatchPeriod:delegate:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackPageview:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker trackEvent:action:label:value:withError:] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker stopTracker] in libGoogleAnalytics.a(GANTracker.o)
-[GANTracker dispatch] in libGoogleAnalytics.a(GANTracker.o)
".objc_class_name_NSUserDefaults", referenced from:
literal-pointer@__OBJC@__cls_refs@NSUserDefaults in libGoogleAnalytics.a(GTMLogger.o)
".objc_class_name_NSThread", referenced from:
literal-pointer@__OBJC@__cls_refs@NSThread in libGoogleAnalytics.a(GTMLogger+ASL.o)
".objc_class_name_NSBundle", referenced from:
literal-pointer@__OBJC@__cls_refs@NSBundle in libGoogleAnalytics.a(GANDataDispatcher.o)
".objc_class_name_NSAssertionHandler", referenced from:
literal-pointer@__OBJC@__cls_refs@NSAssertionHandler in libGoogleAnalytics.a(GANTracker.o)
literal-pointer@__OBJC@__cls_refs@NSAssertionHandler in libGoogleAnalytics.a(GANPersistentEventStore.o)
".objc_class_name_NSLocale", referenced from:
literal-pointer@__OBJC@__cls_refs@NSLocale in libGoogleAnalytics.a(GANDataDispatcher.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
谷歌论坛上的一个建议是创建一个GANTracker类的虚拟实现,以便在模拟器中使用。即创建一个文件GANTracker_stub.m:
#import "GANTracker.h"
#if TARGET_IPHONE_SIMULATOR
@implementation GANTracker
+ (GANTracker *)sharedTracker
{
return [[[GANTracker alloc] init] autorelease];
}
- (void)startTrackerWithAccountID:(NSString *)accountID
dispatchPeriod:(NSInteger)dispatchPeriod
delegate:(id<GANTrackerDelegate>)delegate
{
}
- (void)stopTracker
{
}
- (BOOL)trackPageview:(NSString *)pageURL
withError:(NSError **)error
{
return YES;
}
- (BOOL)trackEvent:(NSString *)category
action:(NSString *)action
label:(NSString *)label
value:(NSInteger)value
withError:(NSError **)error
{
return YES;
}
- (BOOL)dispatch
{
return YES;
}
@end
#endif
然而这不适合我,有什么我想念的吗?
答案 0 :(得分:3)
通过Google Analytics论坛找到解决方案:
使用:
lipo libGoogleAnalytics.a -remove i386 -output libGoogleAnalytics2.a
然后从您的项目中删除libGoogleAnalytics.a并添加libGoogleAnalytics2.a
这仅适用于GANTracker的虚拟实现,如上所示。
答案 1 :(得分:1)
使用Google Analytics for iOS 0.8 SDK可以解决此问题。我今天刚试过。
下载