tags:

views:

48

answers:

1

I downloaded the code for Apple's ZoomingPDFViewer sample application, but I am unable to compile this application. It's showing a warning for this line

NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"TestPage.pdf" withExtension:nil];

NSBundle may not respond to URLForResource:withExtension

I build using the iPhone OS 3.2.1 SDK. Why is it giving me this warning?

+2  A: 

URLForResource:withExtension: method is available starting SDK 4.0. In older systems you need to use other methods, e.g. obtain path to the resource file using pathForResource:ofType: method first and then convert it to NSURL

Vladimir
Thanks bro i got the solution now its working.Thanks a lot again.Hope to help me next time.
sabby
Bro could you help me more,this sample code works for only one page,but what if i want to read a pdf document or book in iphone.I uploaded the book to the bundel but it shows the first page.How to scroll to different pages.Pease give me the solution
sabby
You can get arbitrary pdf page with CGPDFDocumentGetPage function - search that sample to see how it is used to set view contents.
Vladimir