4

I am building a Newsstand universal app. When I download a magazine issue and open it, it runs fine, but when I delete it, redownload, and open it it throws the following:

2013-04-01 22:06:07.672 Magazine[14353:707] *** Assertion failure in -[ReaderContentPage initWithURL:page:password:], /Volumes/Files/Work in progress/el-beit/Magazine/Sources/ReaderContentPage.m:471
2013-04-01 22:06:07.680 Magazine[14353:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CGPDFDocumentRef == NULL'
*** First throw call stack:
(0x35a4788f 0x3366b259 0x35a47789 0x34e3b3a3 0x84e59 0x85ba7 0x96d47 0x976ad 0x34e6d933 0x35a1ba33 0x35a1b699 0x35a1a26f 0x3599d4a5 0x3599d36d 0x33738439 0x33175cd5 0x6cf81 0x6cf08)
terminate called throwing an exception(lldb)

I delete the file by deleting its issue:

NKLibrary *nkLib = [NKLibrary sharedLibrary];
NKIssue *issue = [nkLib issueWithName:[kBaseFeatureID stringByAppendingString:((NSNumber *)self.listOfMonths[index]).stringValue]];
NSString *name = issue.name;
[nkLib removeIssue:issue];
[nkLib addIssueWithName:name date:[self.dateFormatter dateFromString:((NSNumber *)self.listOfMonths[index]).stringValue]];

I am using Newsstand, iOS6, Xcode 4.6, MKStoreKit, and the template of this project: https://github.com/vfr/Reader

The reader seems to be trying to open the deleted file instead of the file I give to it.

Any help would be appreciated, thanks in advance.

  • I found this question, it solves the problem for me. http://stackoverflow.com/questions/15346927/ios-vfr-reader-framework-cannot-use-downloaded-pdf – Dennis Stritzke Jun 01 '13 at 18:30

3 Answers3

1

I solved this issue by using

[[ReaderDocument alloc] initWithFilePath:file password:nil];

instead of

[ReaderDocument withDocumentFilePath:file password:nil];
Carmen
  • 6,177
  • 1
  • 35
  • 40
0

I think that this post could solve your problem.

I get the same error, but from a different Workflow. If I download a file and save it to the filesystem the error appears, but if I add the same file to my AppBundle it gets displayed without any problem.

I hope that this helps, eventually you have any advice whats wrong at my case. I suggest that this is because of the same reason.

Community
  • 1
  • 1
Dennis Stritzke
  • 5,198
  • 1
  • 19
  • 28
0

The plist file was the problem, it didn't get deleted automatically when you deleted your PDF. You have to either make sure all your PDF file names are unique, or remember to delete the plist file which is automatically generated by the Reader based on PDF file name.

E.g. /appid/Library/Application Support/yourPdfFileName.plist

Do it every time when you delete your PDF. It should solve your problem.

ZTAN
  • 71
  • 4