Viewing a PDF file

Discussion in 'iOS Programming' started by Labeno, Oct 17, 2008.

  1. Labeno macrumors regular

    Labeno

    Joined:
    Jul 21, 2008
    #1
    Hi,

    I want to view a PDF file that was added to the list of my app's resources.
    I tried the following, but it did not work.

    NSURL *url = [NSURL URLWithString:mad:"file:Users Guide.pdf"];
    [[UIApplication sharedApplication] openURL:url];

    Anyways suggestions?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Your URL isn't correct. You will need to use NSBundle to get a full path to the resource and, quite possibly, escape characters that are illegal in URLs like spaces.
     
  3. Labeno thread starter macrumors regular

    Labeno

    Joined:
    Jul 21, 2008
    #3
    Example of NSBundle

    I've never used NSBundle. Could you provide an example of using it to get the path of a resource file? Thank you very much.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I'm not about to provide examples of the basics of Cocoa. It's in the documentation. I suggest you read it.
     

Share This Page