Worked perfectly on Swift 1.2
code :
var build = GAIDictionaryBuilder.createEventWithCategory("Record Counter", action: "Images Taken", label: "usersad", value: 1 ).build() as [NSObject : AnyObject]
self.tracker.send(build)
Error :
NSMutableDictionary is not convertible to [NSObject : AnyObject]
Any idea?
You're casting your event wrong. Here is the correct way and one way of doing it.
let tracker = GAI.sharedInstance().defaultTracker
Initialize your Event Tracker as NSObject
let eventTracker: NSObject = GAIDictionaryBuilder.createEventWithCategory(
"ui_action",
action: "button_press",
label: "play",
value: nil).build()
Cast your NSObject as Anyobject within the send method.
tracker.send(eventTracker as! [NSObject : AnyObject])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With