Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use the Mixpanel iOS library inside an application extension? #152

Closed
barfoon opened this issue Aug 18, 2014 · 14 comments
Closed

Comments

@barfoon
Copy link

barfoon commented Aug 18, 2014

If so, how? Currently there are many referenecs to [UIApplication sharedApplication], which is not accessible in application extensions.

Thanks,

@piemonte
Copy link

+1

official support would be nice. any uses of UIApplication aren't available so it would be nice to define a means for avoiding it or just updating the read me to explicitly state the install is different.

here was the issue tracking AFNetworking changes:

https://github.com/AFNetworking/AFNetworking/issues/2119

@alex-hofsteede
Copy link
Contributor

@barfoon @piemonte, I will have a look into how we can do this. The main issue would appear to be with background tasks, as well as using a preprocessor #ifdef to remove all the non-relevant parts of the Mixpanel SDK such as Surveys and Notifications. It does seem possible in theory.

@mmezzacca
Copy link

At the moment we're firing a call to our servers from the app extension which then will manually ping Mixpanel server-side, but would be much nicer to do natively. Looking forward to a solution, thanks!

@benpious
Copy link

It is actually possible to use Mixpanel inside an extension with Cocoapods presently, in case that helps anyone.

@barfoon
Copy link
Author

barfoon commented Dec 1, 2014

@alex-hofsteede Just wondering if there were any updates on this one?

@alex-hofsteede
Copy link
Contributor

@barfoon Sorry I haven't had the time to work on this one yet. Will update when I do.

@transitive-bullshit
Copy link

+1 while it is possible to use Mixpanel inside of an extension, Mixpanel does not properly send events making it useless for my use case.

Note that I'm referencing a custom keyboard extension, and having added MIXPANEL_DEBUG/MIXPANEL_LOG to the preprocessor, it appears that Mixpanel falsely views its state as offline and queues / archives all events instead of reporting them. Here's a gist with verbose mixpanel output showing the issue (note that this is on a device with full connectivity).

@JosephLin
Copy link

@fisch0920 I'm seeing the exact same thing. Manually calling 'flush' seems to work for me. Does doing that have any serious downside?

@iamtony
Copy link

iamtony commented Apr 9, 2015

@alex-hofsteede - Hello, are there any updates to this?

@athasach
Copy link

Looks like it's fixed in v2.8.0. https://github.com/mixpanel/mixpanel-iphone/releases/tag/v2.8.0

@arittr
Copy link

arittr commented May 20, 2015

@iamtony @athasach yes, this is now fixed as of v2.8.0 - let us know if you run into any issues

@alex-hofsteede
Copy link
Contributor

yep use pod "Mixpanel/AppExtension" for your app extension target in your Podfile. I'll put up some docs on the site about this.

@piemonte
Copy link

nice 👌

@JoeFerrucci
Copy link

JoeFerrucci commented Sep 13, 2018

This thread is outdated.
The latest solution is to use pod 'Mixpanel-swift-appex' and can be referenced here:
mixpanel/mixpanel-swift#75 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests