Interactive Ink

[iOS] Failing to import text to a block in a text document

Hey there
I'm having a constant error when trying to add a string into an already existing block


 

IINKMimeTypeValue* mimeType = [[self.editor getSupportedExportMimeTypes:targetBlock] firstObject];
		if (mimeType) {
			[self.editor import_:mimeType.value data:@"some text on the block" block:targetBlock error:&error];
			return;
		}

 targetBlock is a Text type block, I tried using IINKMimeTypeText as well, but regardless what I change, I'm getting the following message:

Error Domain=Interactive Ink SDK Error Domain Code=1 "Error, -[IINKEditor import_:data:block:error:]::520 import mime type not supported" UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor import_:data:block:error:]::520 import mime type not supported}


Any clues what may be happening?


Thanks

 


Dear Gonzalo,


thank you for your question.


Currently, as you are importing data, ideally you should not use the getSupportedExportMimeTypes function but the getSupportedImportMimeTypes instead. 


Indeed, it is likely that when calling getSupportedExportMimeTypes  you are returned with IINKMimeTypeText, which is not supported when importing in a Text document part (it is only supported in a Text part).


Also, as using a Text document part, we recommend you use the getSupportedAddBlockDataMimeTypes to get the MimeType supported in this type of part and import text using the addBlock:type:mimeType:data:error function.


Or, another possibility is that you use a Text part instead of a Text Document part, and use only the getSupportedImportMimeTypes and the import function with the proper MimeType.


Best regards,


Olivier

Hey Oliver, thanks for your detailed answer. Sadly I can't use a Text part, since I'm also working with diagrams.

So, to double check, there's no way of adding text to a particular block in a Text Document part? I'll have to create a new block using addBlock:type:mimeType:data:error function?

Thanks!

Dear Gonzalo,


Indeed, as the Text Document is a container of blocks, the only way to import text is to import a Text Block.


Best regards,


Olivier

Login or Signup to post a comment