<分区>
我尝试使用 Google Analytics我的 Swift 1.2 应用程序使用 Xcode 6.3beta。
我的桥接 header 工作正常并包含:
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"
我尝试了以下 Swift 代码来跟踪页面:
var tracker2:GAITracker = GAI.sharedInstance().defaultTracker as GAITracker
tracker2.set(kGAIScreenName, value:"Home Screen")
tracker2.send(GAIDictionaryBuilder.createScreenView().build())
但是上面的最后一行引发了以下错误:
Cannot invoke 'send' with an argument list of type '(NSMutableDictionary!)'
我发现了类似的问题,例如:Google Analytics not initialising in Swift , Using Google Analytics with Swift on iOS
我必须更改什么才能使上面的代码适用于 Swift 1.2?