iOS objective-c error when adding text to document

Hi All,

I am new to PDFTron.
I have looked around on Google as well as this discussion board and can't find any solution to my problem. All I'm trying to do is add text to the original document.

I am using the annotation example from the sample code page but am getting this following errors:

[Common] _BSMachError: port 9c27; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
[Common] _BSMachError: port 9c27; (os/kern) invalid name (0xf) "Unable to deallocate send right"

The code looks like this:

- (void) CreateTestAnnots:(PTPDFDoc *)doc
{
    PTElementWriter *ew = [[PTElementWriter alloc] init];
    PTElementBuilder *eb = [[PTElementBuilder alloc] init];
    PTElement *element = [[PTElement alloc] init];
    
    PTPage *first_page = [doc PageCreate: [[PTPDFRect alloc] initWithX1: 0 y1: 0 x2: 600 y2: 600]];
    [doc PagePushBack: first_page];
    [ew WriterBeginWithPage: first_page placement: e_ptoverlay page_coord_sys: NO compress: NO]; // begin writing to this page
    [ew End]; // save changes to the current page
    
    //
    // Test of a free text annotation.
    //
    {
        PTFreeText *txtannot = [PTFreeText Create: [doc GetSDFDoc] pos: [[PTPDFRect alloc] initWithX1: 10 y1: 400 x2: 160 y2: 570]];
        [txtannot SetContents: @"\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare."
         "\n\nAha!\n\nAnd there was much rejoicing!"];
        //std::vector<double> dash( 2, 2.0 );
        [txtannot SetBorderStyle: [[PTBorderStyle alloc] initWithS: e_ptsolid b_width: 1 b_hr: 10 b_vr: 20] oldStyleOnly: YES];
        [txtannot SetQuaddingFormat: 0];
        [first_page AnnotPushBack: txtannot];
        [txtannot RefreshAppearance];
    }
}

Would appreciate any help,
Thanks in advance.

What line of code triggers those messages?

Also, are those exceptions, or you see those messages in a terminal?

Can you also let me know what version of PDFNet you are using?
[PDFNet GetVersion]