Open simongiesen opened 10 years ago
Same problem here.
I'll try to fix this issue.
i have same problem
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.
I'm having this issue too
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.
@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.
@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?
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
(NSString )relativeFilePath:(NSString )fullFilePath {
assert(fullFilePath != nil); // Ensure that the full file path is not nil
NSString *applicationPath = [RoboDocument applicationPath]; // Get the application path
NSRange range = [fullFilePath rangeOfString:applicationPath]; // Look for the application path
assert(range.location != NSNotFound); // Ensure that the application path is in the full file path
return [fullFilePath stringByReplacingCharactersInRange:range withString:@""]; // Strip it out }
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