Mam zintegrowany Google Analytics library do mojego projektu.Google Analytics w iOS 8 przy użyciu Swiftu nie działa
Potem skonfigurowany bridging header file i Dodałem następujące nagłówki Google Analytics
#import "Libraries/GoogleAnalytics/GAI.h"
#import "Libraries/GoogleAnalytics/GAIFields.h"
#import "Libraries/GoogleAnalytics/GAILogger.h"
#import "Libraries/GoogleAnalytics/GAITracker.h"
#import "Libraries/GoogleAnalytics/GAIDictionaryBuilder.h"
Inicjalizacja biblioteki w AppDelegate.swift kompiluje i działa poprawnie. dodać poniższy kod, żeby śledzić zdarzenie
var tracker = GAI.sharedInstance().defaultTracker
tracker.send(GAIDictionaryBuilder.createEventWithCategory(category, action: action, label: label, value: value).build())
Podczas próby wygenerowania kompilacji, pojawia się następujący błąd
Undefined symbols for architecture x86_64:
"_NSOverwriteMergePolicy", referenced from:
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_SCNetworkReachabilityCreateWithName", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilitySetCallback", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_deflate", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateEnd", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflate", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateEnd", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Używam Xcode 6 GM i spróbować skompilować aplikacja działa w Symulator iPhone'a 5s.
Edit1: wymagana już dodano
biblioteki
- CoreData.framework
- SystemConfiguration.framework
- libz.dylib
I częściowo rozwiązany błąd w dodawaniu mostu r złożyć następujące importu
#import <CoreData/CoreData.h>
#import <SystemConfiguration/SystemConfiguration.h>
Komunikat o błędzie jest zredukowana do
Undefined symbols for architecture x86_64:
"_deflate", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateEnd", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflate", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateEnd", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit2:
końcu rozwiązać ten problem.
W ustawieniach systemu docelowego -> Budowanie Ustawienia -> Połączenie -> Pozostałe Flagi Linker dodać następujące flagi: -lz
Właśnie dodałem Google Analytics dla telefonu komórkowego do mojego Swift aplikacji i nie trzeba przejść przez dość jak wielu twoich obręcze. Musiałem tylko dodać GAI.h i do nagłówka pomostowego i działa dobrze. Nie musiałem bawić się ustawieniami kompilacji. Mogli dodać lepszą obsługę od twojego postu. –