Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

iOS 9 page_close hangs 7 years 1 month ago #12069

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
Hello,

I've been integrating the library to some of our projects, and I found the following issue:

on iOS 10 it works fine; however, I had complaints that it does not work on iOS 9.1 and I checked it on the iPad simulator iOS 9.1.

In my code, I do the following: (not important parts are cut out, I need to fill some annotations and just save the doc)

PDFDoc *doc = [[PDFDoc alloc] init];
[doc open:_pdfPath :@""];

int pages = [doc pageCount];
for(int index = 0; index < pages; index++){
PDFPage *page = [doc page:index];
[page objsStart];
int annots = [page annotCount];
for(int annot = 0; annot < annots; annot++){
// [annotation setEditText:string];
// do some stuff - prepopulate annots with text
}
}
[doc save]
After that I open the document again in viewer and let user view it. (But app does not get to that point)

After the method ends, the document gets released and app hangs: see code below.

Pausing the app shows that it hangs in the dealloc method of PDFPage class:
-(void)dealloc
{
PDF_PAGE tmp_page = m_page;
m_page = NULL;
Page_close(tmp_page); // here it hangs
}



If use the library as always, to view, it works just fine (pages deallocate fine as well); on iOS 10 works just fine as well.


If i can help you more, please let me know.
Thanks.
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by valkuz1.

iOS 9 page_close hangs 7 years 1 month ago #12070

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

which SDK version are you using?
Did you try to set page = nil after the for circle where you set annotations?
PDFPage *page = [doc page:index];
[page objsStart];
int annots = [page annotCount];
for(int annot = 0; annot < annots; annot++){
   // [annotation setEditText:string];
   // do some stuff - prepopulate annots with text
}
page = nil; <-- set page to nil here

Please Log in or Create an account to join the conversation.

iOS 9 page_close hangs 7 years 1 month ago #12071

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
this one:

www.radaeepdf.com/download/download-prev...e/43-radaeepdf-3-8-1

about page to nil:
just tried, no effect, unfortunately (also, this is in isolated method, so it gets nil when method returns, no pointers are left to the page or doc)

Please Log in or Create an account to join the conversation.

iOS 9 page_close hangs 7 years 1 month ago #12127

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
hi guys:) any news on that? Thanks!

Please Log in or Create an account to join the conversation.

iOS 9 page_close hangs 7 years 1 month ago #12137

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

are you calling your function while the pdf is opened? In this case it's possible that multiple instance of the PDFDoc of the same pdf could give this hanging issue.
You can try to set the current PDFDoc instance as function parameter, it will avoid this issue.
Try something like:
- (void)testMethod:(PDFDoc *)doc
{
    int pages = [doc pageCount];
    for(int index = 0; index < pages; index++){
        PDFPage *page = [doc page:index];
        [page objsStart];
        int annots = [page annotCount];
        for(int annot = 0; annot < annots; annot++){
            
            PDFAnnot *annotation = [page annotAtIndex:annot];
            [annotation setEditText:@"test"];
            // do some stuff - prepopulate annots with text
        }
        page = nil;
    }
    [doc save];
}

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum