You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello KurtCode and GitHub,
I have been working to leverage PDFKitten as a search for a project primarily using VFR Reader as it's PDF Viewer. I have been able to add the -fno-objc-arc flag to all the PDFKitten files to get them to build.
I'm using PDFKitten to search through the PDF and report if each page has a search term like so:
(Note: document is an instance of the VFR Reader ReaderDocument class)
#import"Scanner.h"// Search Document and create Array that holds how many hits per page.NSInteger intPageCount = [pageCount integerValue];
NSInteger i = 1;
CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateUsingUrl((__bridge CFURLRef)(document.fileURL), document.password);
for(i = 1; i < intPageCount; i++) {
CGPDFPageRef searchPage = CGPDFDocumentGetPage(thePDFDocRef, i);
NSString *currentSearch = searchBar.text;
Scanner *scanner = [Scanner scannerWithPage:searchPage];
NSArray *selections = [scanner select:currentSearch];
// Send the results of the search to the searchMarked NSMutable Array.if(selections.count > 0) {
NSNumber *searchPageHit = [NSNumbernumberWithInteger:i];
[searchmarked addObject:searchPageHit];
}
}
This code works, returning me an array of page numbers that contain my search term. However, every time I search quite a bit more ram is taken up. I suspect this is because I am instantiating the Scanner class from within a class using ARC, but the Scanner class itself uses MRC.
Here is output from Leaks after one successful search:
I have tried to convert PDFKitten to use ARC, and I'm afraid I'm just a littler too new with iOS to pull this off. I have also tried setting scanner to nil after it is used in every pass of the for loop, but it doesn't seem to make any difference. In addition, I have tried wrapping the for loop around an autorelease pool, and that didn't work either.
I will continue work, but any help would be greatly appreciated.
Thankyou KurtCode and GitHub community in advance for any advice or help you can offer.
Update: I have just noticed a pull request by user tarunbatta that has ARC fixes for PDFKitten. I will implement these to my PDFKitten base this evening and report back to this thread.
The text was updated successfully, but these errors were encountered:
Hello KurtCode and GitHub,
I have been working to leverage PDFKitten as a search for a project primarily using VFR Reader as it's PDF Viewer. I have been able to add the -fno-objc-arc flag to all the PDFKitten files to get them to build.
I'm using PDFKitten to search through the PDF and report if each page has a search term like so:
(Note: document is an instance of the VFR Reader ReaderDocument class)
This code works, returning me an array of page numbers that contain my search term. However, every time I search quite a bit more ram is taken up. I suspect this is because I am instantiating the Scanner class from within a class using ARC, but the Scanner class itself uses MRC.
Here is output from Leaks after one successful search:
I have tried to convert PDFKitten to use ARC, and I'm afraid I'm just a littler too new with iOS to pull this off. I have also tried setting scanner to nil after it is used in every pass of the for loop, but it doesn't seem to make any difference. In addition, I have tried wrapping the for loop around an autorelease pool, and that didn't work either.
I will continue work, but any help would be greatly appreciated.
Thankyou KurtCode and GitHub community in advance for any advice or help you can offer.
Update: I have just noticed a pull request by user tarunbatta that has ARC fixes for PDFKitten. I will implement these to my PDFKitten base this evening and report back to this thread.
The text was updated successfully, but these errors were encountered: