Interactive Ink

CopyPaste from different IINKContentPackage

 Hey guys!

I'm having some problems trying to copy a block from one text document, and then pasting it into a different text document.

This is the code I'm using, in this case self.editor already has an active part, which is working fine with text recognition and other kind of bloks.


NSError* error;
	NSString *fullPath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"iink"];
	IINKContentPackage*	package = [[IinkManager getInstance].engine openPackage:fullPath error:&error];
	IINKContentPart *part = [package getPartAt:0 error:&error];
	actualPart = self.editor.part;
	self.editor.part = part;
	secondaryEditor.part = part;
	pasteBlock = [self.editor.rootBlock.children firstObject];
	[self.editor copy:pasteBlock error:&error];

	self.editor.part = actualPart;

	CGPoint bottom = [self getBottomPoint];
	NSError* error;
	BOOL didPaste = [self.editor paste:bottom error:&error];

 The first nslog prints 1, while the second one (after the part is changed) is already 0. Nevertheless didPaste is true at the end of the execution

Any hints?


Dear Gonzalo,

thank you for your question.

Currently, the only explanation for the block being no longer valid is that the currently edited part has changed in between both calls.

As the part is assigned to 2 editors, you can try to waitForIdle for both editors, and see if in this latter case you are still getting invalid block at the second NSLog.

Best regards,


Thanks Oliver. Though the problem may not be the invalid block. Is this what I should be doing to copy a block from one Text Document to another one?

Hey Oliver.

I just figured it out, thanks for your help!

Dear Gonzalo,

thank you for the update, we are glad issue is solved!

Best regards,