Cannot convert value of type 'NSMutableDictionary' to type '[NSObject: AnyObject]' in coercion for google ios Analytics

前端 未结 4 1990
南方客
南方客 2020-12-14 16:42

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 = GA         


        
4条回答
  •  旧巷少年郎
    2020-12-14 17:17

    For GA 3.17.0 use:

    let tracker = GAI.sharedInstance().defaultTracker
    let builder = GAIDictionaryBuilder.createEvent(withCategory: category,
                                                         action: action,
                                                          label: nil,
                                                          value: nil).build()
    tracker?.send(builder as [NSObject : AnyObject]!)
    

    Note the ! at the end of [NSObject: AnyObject]!.

提交回复
热议问题