Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6204005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:00:53+00:00 2026-05-24T05:00:53+00:00

I am new to iphone development. I am developing an iphone application in which

  • 0

I am new to iphone development. I am developing an iphone application in which i am downloading files using web service with following code:

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath =  [paths objectAtIndex:0];
NSString *fileLoc = [basePath stringByAppendingString:@"/filename.pdf"];
NSData *fileData = [self decodeBase64WithString:soapResults];
[fileData writeToFile:fileLoc atomically:YES];

And my file is in path : /Users/myusername/Library/Application Support/iPhone Simulator/4.0/Applications/7A627E64-DEAB-40FA-BE04-35ED50580B65/filename.pdf

How can i open this file using uiwebview??? I tried this:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath =  [paths objectAtIndex:0];
NSString *fileLoc = [basePath stringByAppendingString:@"/filename"];
[self loadDocument:fileLoc inView:mywebview];

My loadDocument method is:

-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView
{
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];  
}

But it showing error… I think location is the problem.. How can i find the path in simulator as well as in orignal device???

Please help me…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:00:54+00:00Added an answer on May 24, 2026 at 5:00 am

    pathForResource:ofType: can only be used to load resource files, which are shipped as part of your application bundle. You’re trying to load a downloaded file from your Documents directory. So you should be able to just do

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *basePath =  [paths objectAtIndex:0];
    NSString *fileLoc = [basePath stringByAppendingString:@"/filename.pdf"];
    NSURL *url = [NSURL fileURLWithPath:fileLoc];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to Objective C/iPhone Development. I am developing a simple app
Very new to Iphone development here, I have a project which is successfully building
I am new to iPhone development and trying to load PNGs using libpng but
I am new to iPhone development and want to know which database you use
I'm new to iPhone development and Objective-C. Using the ZBar SDK I've developed a
I am new to iphone development .I have displayed a list of contents in
I'm new to iPhone development, and I've just run my iPhone app throught the
I am new to iPhone development. I have two views named pickerviewcontroller and secondviewcontroller
I am new to iPhone programming and have a MacBook running Leopard with XCode
I have an NSArray containing several NSDictionaries . I have an NSString containing an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.