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

ERROR: apiKey cannot be nil or empty, set apiKey with initializeApiKey: before calling logEvent #93

Closed
ileitch opened this issue Apr 27, 2016 · 5 comments

Comments

@ileitch
Copy link

ileitch commented Apr 27, 2016

This error pollutes our logs for development builds because we only enable Amplitude for builds that we distribute to other people.

Is there anything we can do to silence it?

@djih
Copy link
Member

djih commented Apr 27, 2016

@ileitch sorry unfortunately no way to silence it at the moment. I will add a debug flag to guard against these warning messages in the next release.

@djih
Copy link
Member

djih commented Jun 14, 2016

@ileitch can I ask you what your use case is? The error is printed when you try to call an Amplitude function before you initialize. If you only enable it for certain builds, then shouldn't you only call the function if it is enabled?

@ileitch
Copy link
Author

ileitch commented Jun 14, 2016

Our app delegate contains this:

- (void)configureAmplitude {
    NSString *apiKey;

#ifdef RELEASE_SCHEME
    apiKey = @"...";
#elif defined(ADHOC_ALPHA_SCHEME) || defined(ADHOC_BETA_SCHEME)
    apiKey = @"...";
#else
    // Uncomment to test Amplitude with debug builds.
    // apiKey = @"...";
#endif

    if (apiKey) {
        [[Amplitude instance] initializeApiKey:apiKey];
    }
}

To avoid the warning we would need to put a similar condition around every point that we trigger an event, which would not be ideal.

@djih
Copy link
Member

djih commented Jun 15, 2016

You can disable error messages in v3.8.1: https://github.com/amplitude/Amplitude-iOS/releases/tag/v3.8.1

@djih djih closed this as completed Jun 15, 2016
@ileitch
Copy link
Author

ileitch commented Jun 15, 2016

Thanks, but I think I'd rather just live with this minor annoyance than disabling all error messages, I may silence something that's actually important.

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

No branches or pull requests

2 participants