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 6070227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:54:34+00:00 2026-05-23T09:54:34+00:00

I am using ASIHTTPRequest to download tiles to be used in my MKMapView. Testing

  • 0

I am using ASIHTTPRequest to download tiles to be used in my MKMapView. Testing the code it downloads whatever I download into a NSData variable. (My files average 50mb) Note that this is basically almost the same as this unanswered question.

I have found that I can directly download the file from my webserver into a file e.g.:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadDestinationPath:@"/Users/ben/Desktop/my_file.txt"];

For mapview I need the files in a folder called Tiles which is inside my app’s build. It ends up in this directory:

/var/mobile/Applications/887F4691-3B75-448F-9384-31EBF4E3B63E/MyApp.app/Tiles

Which I found out when I called:

NSLog(@"%@",[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Tiles"]);

So what I am trying to do now is download these files (take note the plural) and put them in in the Tiles folder. To start with, I can either ZIP these images together to extract later on my device and place in the Tiles folder, or I can just go ahead and download all the images separately (which seems easier since I already know all the file-names)

I tried this piece of code and it gives me an error. It is in my mapview’s viewDidLoad just before I load the tiles. Take note it is only there for testing the download-code and will later be place somewhere else to be triggered by a button.

Here is the code:

NSURL *url = [NSURL URLWithString:@"http://...my-website.../25.png"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadDestinationPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Tiles"]]; // THE PROBLEMATIC LINE
[request startSynchronous];
NSError *error = [request error];
if(!error)
{
    NSLog(@"Loaded Map");
}
else
{
    NSLog(@"Error occured while loading map");
    NSLog(@"%@",error);
}

And this appears in the console:

2011-06-26 21:12:09.651 MyApp[5309:707] Error occured while loading map
2011-06-26 21:12:09.669 MyApp[5309:707] Error Domain=ASIHTTPRequestErrorDomain Code=8 "Failed to delete file at path '/var/mobile/Applications/887F4691-3B75-448F-9384-31EBF4E3B63E/MyApp.app/Tiles'" UserInfo=0x184b20 {NSUnderlyingError=0x1d4ac0 "The operation couldn’t be completed. (Cocoa error 513.)", NSLocalizedDescription=Failed to delete file at path '/var/mobile/Applications/887F4691-3B75-448F-9384-31EBF4E3B63E/MyApp.app/Tiles'}

So how can I store the downloaded file in a directory on the iPhone where I can find and use it later?

Thanks for the trouble.

  • 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-23T09:54:35+00:00Added an answer on May 23, 2026 at 9:54 am

    You can’t write directly into your application bundle. You should use a directory inside your app’s sandbox, such as /Documents or /Library/Caches. See Getting paths to standard application directories for how to get these paths.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of my project is to download several large size files using ASIHTTPRequest in
So I'm using ASIHTTPRequest to download a video file from my FTP. It downloads
I'm using ASIHTTPRequest to download a list of 30 files but 2 or 3
I am trying to save data into cache using ASIHTTP ( http://allseeing-i.com/ASIHTTPRequest/How-to-use#using_a_download_cache ). I
I was trying to implement ASIHTTPRequest to download files from a server. I have
Hello good morning everyone. I am using asihttprequest for a series of images download
I want to download a file using ASIHTTPRequest, and I want it to behave
I got some question is using ASIHTTPRequest to tracking Upload/Download progress This is the
I'm using ASIHTTPRequest to download data from the internet. If I lose my internet
I am using ASIHTTPRequest to download some data. I have the following in a

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.