mixpanel / mixpanel-swift

Official iOS (Swift) Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
434 stars 234 forks source link

Can't find shared initializer function in latest Mixpanel Pod: Mixpanel.initialize(token: ...) #417

Closed zkhalapyan closed 3 years ago

zkhalapyan commented 3 years ago

Following the examples on Mixpanel's Swift setup, I am using the initialize(..) function. However, it seems like this has either been removed, deprecated or renamed. Can you please advice.

// Getting error, "Argument passed to call that takes no arguments"
Mixpanel.initialize(token: "...")

I am on Xcode 12, installing latest Mixpanel via CocoaPods.

Is the correct option to use Mixpanel.sharedInstance(withToken: mixpanelToken)?

zkhalapyan commented 3 years ago

Oh, was using pod 'Mixpanel' instead of pod 'Mixpanel-Swift'. There is no way to prevent this mistake from happening yeh?

zihejia commented 3 years ago

hi @zkhalapyan , for our Swift SDK, we recommend using SPM to integrate so it's unlikely to have this kind of mistake. In Xcode, select File > Swift Packages > Add Package Dependency. Follow the prompts using the Github URL for Mixpanel Swift library and a minimum semantic version of v2.8.0