I want to add google Analytics ios into my project but i got some problems when i tried to paste their code into my app like the code below.
var tracker = GAI.sharedInstance().defaultTracker
tracker.set(kGAIScreenName, value: "rootPlayView")
var builder = GAIDictionaryBuilder.createScreenView()
tracker.send(builder.build() as [NSObject : AnyObject])
Then i got an error like this
how can i fix this?
Thanks!
This answer has been updated for Swift 3
OR...
For GA 3.17.0 use:
Note the
!
at the end of[NSObject: AnyObject]!
.Small follow up on the amazing answers, in swift 3, the method is
type converson
Swift3
Screen Track
Objective-C
Automatic Screen Tracking
Swift3
Objective-C
event Track
Swift3
Objective-C
or use
for more information see this
example
try this
for screen track
for event Track