- Posts: 13
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about iOS development and PDF
iOS 9 page_close hangs
IP: 192.168.0.71
9 years 1 week ago - 9 years 1 week ago #12069
by valkuz1
iOS 9 page_close hangs was created by valkuz1
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.
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.
Last edit: 9 years 1 week ago by valkuz1.
IP: 192.168.0.71
9 years 1 week ago #12070
by emanuele
Replied by emanuele on topic iOS 9 page_close hangs
Hi,
which SDK version are you using?
Did you try to set page = nil after the for circle where you set annotations?
which SDK version are you using?
Did you try to set page = nil after the for circle where you set annotations?
Code:
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
IP: 192.168.0.71
9 years 1 week ago #12071
by valkuz1
Replied by valkuz1 on topic iOS 9 page_close hangs
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)
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)
IP: 192.168.0.71
8 years 11 months ago #12127
by valkuz1
Replied by valkuz1 on topic iOS 9 page_close hangs
hi guys:) any news on that? Thanks!
IP: 192.168.0.71
8 years 11 months ago #12137
by emanuele
Replied by emanuele on topic iOS 9 page_close hangs
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:
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:
Code:
- (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];
}
Time to create page: 0.413 seconds