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

when calling register sdk returns "Apptentive already initialized" #114

Open
mtpjr88 opened this issue Feb 21, 2020 · 6 comments
Open

when calling register sdk returns "Apptentive already initialized" #114

mtpjr88 opened this issue Feb 21, 2020 · 6 comments

Comments

@mtpjr88
Copy link

mtpjr88 commented Feb 21, 2020

RCT_EXPORT_METHOD(
	register:(NSDictionary *)configurationDictionary
	resolver:(RCTPromiseResolveBlock)resolve
	rejecter:(RCTPromiseRejectBlock)rejecter
) {
	if (self.registered) {
		rejecter(kRejectCode, @"Apptentive is already initialised", nil);
		return;
	}

This will boolean will always return true since
apptentiveKey and apptentiveSignature are required fields for the js sdk ie docs:
https://learn.apptentive.com/knowledge-base/react-native-integration-reference/

    const configuration = new ApptentiveConfiguration(
      credentials.apptentiveKey,
      credentials.apptentiveSignature
    );
- (BOOL)isRegistered {
	return Apptentive.shared.apptentiveKey != nil && Apptentive.shared.apptentiveSignature != nil;
}
@mtpjr88
Copy link
Author

mtpjr88 commented Feb 21, 2020

@frankus

@CaseyApptentive
Copy link

Hi @mtpjr88, thanks for reaching out. We'll take a closer look and get back to you with next steps.

Are you able to launch any Apptentive dialogs despite this?

@CaseyApptentive
Copy link

Hi @mtpjr88. My team mentioned that it looks like you're registering Apptentive twice.

Can you see any way that that might be possible? Also, is this preventing any Apptentive Dialogs from displaying?

We haven't seen this before so would appreciate your feedback in order to make a recommendation. Thanks!

@mtpjr88
Copy link
Author

mtpjr88 commented Feb 25, 2020

@CaseyApptentive
well the issue is that Apptentive.shared.apptentiveKey and Apptentive.shared.apptentiveSignature
are required fields in the javascript sdk

const configuration = new ApptentiveConfiguration(
      credentials.apptentiveKey,
      credentials.apptentiveSignature
    );

thus Apptentive.shared.apptentiveKey and Apptentive.shared.apptentiveSignature
will not come as nil
and will always throw "Apptentive already initialized";

@rpadilla6
Copy link

Seems like this thread might be dead, but chiming in to report I'm getting the same issue reported here.

@johnhaup
Copy link

johnhaup commented Oct 30, 2020

As a way to avoid seeing the warning message in the app and in any error tracking services, you can swalllow it this way:

export const registerApptentive = async () => {
  const configuration = new ApptentiveConfiguration(
    credentials.apptentiveKey,
    credentials.apptentiveSignature,
  );
  try {
    await Apptentive.register(configuration);
  } catch {
    // Do whatever or nothing at all
  }

But ideally the library shouldn't throw a warning for a method that's required to use it.

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

4 participants