vaivaikitay / RoboReader

iOS PFD reading framework
MIT License
139 stars 32 forks source link

RoboReader and iOS8 #9

Open simongiesen opened 10 years ago

simongiesen commented 10 years ago

I try to use your RoboReader in an iOS8 project.

Sadly, it’s not possible to use it. Could you have a look at the following issue?

In

I get

Assertion failed: (range.location != NSNotFound), function +[RoboDocument relativeFilePath:], file /Users/simongiesen/Downloads/RoboReader-master/RoboReader/Classes/RoboDocument.m, line 86.

fullFilePath NSString * @"/Users/simongiesen/Library/Developer/CoreSimulator/Devices/767C8674-F0B1-4516-873C-177D0D09B1F5/data/Containers/Bundle/Application/9E7690A0-0BBF-4727-99F9-F381B12A2C25/RoboReader.app/f5_newspaper.pdf“ 0x00007fc1fca350a0

applicationPath NSString * @"/Users/yasemingiesen/Library/Developer/CoreSimulator/Devices/767C8674-F0B1-4516-873C-177D0D09B1F5/data/Containers/Data/Application/0D0BE960-37EC-4C27-AEB2-010C4574E7DB“ 0x00007fc1fa53a860

hebertialmeida commented 10 years ago

Same problem here.

vaivaikitay commented 10 years ago

I'll try to fix this issue.

Yasika commented 10 years ago

i have same problem

Yasika commented 10 years ago

Hi Please try this code for ios 8

1) In RoboDocument.m File

Old Code (iOS 7) : _fileName = [RoboDocument relativeFilePath:fullFilePath];

New Code (iOS 8) : _fileName =@“/mypdfname.pdf"; //Use your PDF name

2) In CGPDFDocument.m File

Old Code (iOS 7) : thePDFDocRef = CGPDFDocumentCreateWithURL(theURL);

New Code (iOS 8) : NSString aStrFilePath = [[NSBundle mainBundle]pathForResource:@"mypdfname" ofType:@"pdf"]; NSURL aUrlObj = [[NSURL alloc]initFileURLWithPath:aStrFilePath]; thePDFDocRef = CGPDFDocumentCreateWithURL((__bridge CFURLRef)aUrlObj);

This worked for me.

zaun commented 10 years ago

I'm having this issue too

zaun commented 10 years ago

Hi @hebertialmeida - I tried your fix but still crash. I looks like you're not copying all the PDFs to the documents folder. I've got several 100 documents that are just for viewing, but when I pass the full path from the application bundle I get a crash...

Assertion failed: (range.location != NSNotFound), function +[RoboDocument relativeFilePath:], file /Users/user/Development/app/RoboReader/Classes/RoboDocument.m, line 87.

One of the main reasons I picked RoboReader over others was that I didnt have to copy over the PDFs. This may fix the crash, but it changes the functionality of RoboReader too.

hebertialmeida commented 10 years ago

@zaun since iOS 8, the application's ~/Documents directory no longer lives in its bundle, any bundled PDF files must be copied into the the application's ~/Documents directory before they can be accessed.

zaun commented 10 years ago

@hebertialmeida - The ~/Documents folder never did, its in the sandbox space used for read/write file access. I just need to view the PDFs so why do I need read/write access? I can load images/audio right from the bundle without having to duplicate the files into the users ~/Documents folder.

Am I missing something special? does RoboReader need to modify the PDF files?