Interactive Ink

IINKEngine initWithCertificate returning nil

Hi

I am integrating IINK with React Native and initWithCertificate method is returning nil.

`self.engine = [[IINKEngine alloc] initWithCertificate:certificateData];`

I checked certificate file in both GetStarted and my code and they are same (both certificateData has same length: 4447 and binary value).

But on GetStarted project, above method is returning engine.

Does initWithCertificate use any global value to initialize engine?


Hi Peter,

Do you have "INVALID CERTIFICATE" printed in your output console? Certificates are dependent of the bundle id of the target application: if you reuse the GetStarted certificate into your own app, you are likely to encounter this error. Please refer to the on-device license management section of the documentation to see how to generate a new certificate for your app.
I hope this helps.

Best regards,
Thomas

 

Hey!

I'm facing the same error, and get the "INVALID CERTIFICATE" message as well. The point is I'm using my own certificate, and I actually tried my certificate, with my bundle id on the example you provided from github and it works withouth any problem.


Any idea what may be causing it?


Also, I've added the classes manually (both MyScriptInteractiveInk-Runtime and IInkUIReferenceImplementation) since doing pod install is giving me [!] Unable to find a specification for 'MyScriptInteractiveInk-UIReferenceImplementation'

I have no compilation errors (had to change some imports) but when I try to create the Engine it doesn't work.

Thanks in advance!

Dear Gonzalo,


currently, is it occurring on a brand new install or 30 days after installing the application on the device?

-Indeed, if it is a brand new install, can you please check the "PRODUCT_BUNDLE_IDENTIFIER" has been properly set in your project.pbxproj file?

-If after 30 days, it is likely because the application is not able to connect to the internet to activate the license. Indeed, the iink SDK needs to connect once to our servers to activate the license. If not done 30 days after the first install, you will have the "INVALID CERTIFICATE" message.


Best regards,


Olivier

Hey Oliver, thanks for your answer. It's hapenning on a brand new instalation, on a device with internet connection. I tried with two different bundle id's, with it's respective certificates, non of them worked. In this validation been made on your side? With https? Or should I add a rule to enable a http url? Thanks

I noticed I also get the message "Error: NO_SUCH_ENGINE" before the invalid certificate. Does that give any clues?

Dear Gonzalo,


this is indeed of help! Can you confirm all the libs that are located into the "iink\bin\ios-x86+x64+armv7+arm64\" directory are linked to your project?


Best regards,


Olivier

Sorry Oliver, I'm a little lost here. You mean inside "libiink.a" ? (I can't figure out how to open it if that's so), or do you mean all the ".a"s which are with libiink.a? if that's the case all have been added to the project

Hey oliver, any other thing I may try to give you more data?

Dear Gonzalo,


currently, you should ensure the native libraries are linked exactly the same order than in the default samples we provide (you can refer to these). This is normally the order the libraries should be linked:

libMyScript2D.a
libMyScriptAnalyzer.a
libMyScriptDocument.a
libMyScriptGesture.a
libMyScriptInk.a
libMyScriptMath.a
libMyScriptPrediction.a
libMyScriptShape.a
libMyScriptText.a
libMyScriptEngine.a
libiink.a


Best regards,


Olivier

Hey Oliver. Sadly there wasn't any change. I'm still getting "NO_SUCH_ENGINE" message

I rearranged the libs as you requested:

image


image


Is there any error with my code? Should I do anything else besides this?

 

 certificate = [NSData dataWithBytes:myCertificate.bytes length:myCertificate.length];
    
    if (certificate.length == 0)
    {
      NSLog(@"Please replace the content of MyCertificate.c with the certificate you received from the developer portal");
      return nil;
    }
    
    // Create the iink runtime environment
    NSData* certificateData = [NSData dataWithBytes:certificate.bytes length:certificate.length];
    _engine = [[IINKEngine alloc] initWithCertificate:certificateData];
  
    if (_engine == nil)
    {
      NSLog(@"Invalid certificate");
      return nil;
    }

 



Dear Gonzalo,


currently, based on the above, everthing seems correct... Engine creation is done as we recommend, and libraries seems to be added properly. Can you please try again to remove all the native libraries from you project, and attach these again?


If this doesn't help, we would need your project to investigate further.


Best regards,


Olivier

Hey Oliver.

The order was the answer in the end. It started working once I set that order on the linked frameworks and libraries of the target (under General section). Thanks for that.


Now I have a different issue, the writings aren't appearing. I check using background colors and both the EditorViewController's view and it's input view are in place, and the input view is receiving the touches. Any idea why may this be?


Thanks again!

 I'm not using a storyboard, so this is the way I'm creating the editorViewController



 

txtField.editorView = [[EditorViewController alloc] init];
      txtField.editorView.view.frame = CGRectMake(0, 0, 8000, 8000);
      txtField.editorView.engine = [IinkManager sharedInstance].engine;
      txtField.editorView.inputMode = InputModeForcePen;
      [reactFieldView addSubview:txtField.editorView.view];

 

Login or Signup to post a comment