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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:48:03+00:00 2026-05-26T19:48:03+00:00

I am trying to use the ASIDownloadCache from the ASIHTTPRequest library. I think I

  • 0

I am trying to use the ASIDownloadCache from the ASIHTTPRequest library. I think I have it almost set up but the data I am printing to the log is a bunch of numbers.. I think it might be a formatting problem.. but I would like to run it past someone with more experience first to make sure I’m doing it correctly and then to hopefully help me fix the issue.

The code belows shows you how I am setting up my cache, I am using this view for several data sets, hence the need to use an if statement so that I am only setting up the cache on specific data.

- (IBAction)setRequestString:(NSString *)string
{
    //Set database address
    NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"http://***.***.***.***:8888/codeData/"]; // iphone development

    //PHP file name is being set from the parent view
    [databaseURL appendString:string];

    //call ASIHTTP delegates (Used to connect to database)
    NSURL *url = [NSURL URLWithString:databaseURL];

    checkDataSet = [[NSString alloc] initWithFormat:string];  //Loads ICMfg.xml into checkDataSet for setting up cache

    //Create If statments here
    if ([checkDataSet isEqualToString:@"ICMfg.xml"]) {     

        //Cache stuff goes in here
        ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
        [request setDownloadCache:[ASIDownloadCache sharedCache]];
        [request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
        [request setCachePolicy:ASIOnlyLoadIfNotCachedCachePolicy];
        [request setSecondsToCache:60*60*24*30]; // Cache for 30 days

        [request setDelegate:self]; // A delegate must be specified
        [request startSynchronous];
        //[request setDidFinishSelector:@selector(requestFinished:)]; // And an appropriate

    }
    else 
    {
    //this else statments lets all of the other datasets come through here
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

    [request setDelegate:self];
    [request startAsynchronous];
    }

}

From here, when [checkDataSet isEqualToString:@”ICMfg.xml”] is true it will set the cache parameters and then calls the following method where I get everything ready to parse my information

- (void)requestFinished:(ASIHTTPRequest *)request
{   
    if ([checkDataSet isEqualToString:@"ICMfg.xml"]) {
        BOOL success = [request didUseCachedResponse];
        NSLog(@"------------>>>>>>> Success is %@\n", (success ? @"YES" : @"NO"));


        responseString = [request responseString];        
        capturedResponseData = [responseString dataUsingEncoding:NSUTF8StringEncoding]; 

        NSLog(@"%@", capturedResponseData); //this prints out the weird data.

        [self startTheParsingProcess:capturedResponseData];

    }
    else
    {
    responseString = [request responseString]; //Pass requested text from server over to NSString 
    capturedResponseData = [responseString dataUsingEncoding:NSUTF8StringEncoding]; 

    [self startTheParsingProcess:capturedResponseData];
    }
}

From here, I check my nslog to see the result of that NSlog and it spits out a bunch of numbers, below is a small section of the output. The next step for me is to check to see if anything is actually being parsed.. and also to see if the cache is working or not.. then I need to figure out hopefully with your help how to format the data correctly if thats my main problem..

also I would like to ask how to get this working asynchronously as currently I can only get it to work synchonosly.

2011-11-09 09:29:55.216 code[3968:207] ------------>>>>>>> Success is YES
2011-11-09 09:29:55.239 code[3968:207] <3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67 3d225554 462d3822 3f3e0d0a 3c494345 6e673e3c 52657375 6c742044 42566572 73696f6e 3d223132 33223e3c 5461626c 65733e3c 5461626c 65205461 626c654e 616d653d 2249434d 6667223e 3c526f77 733e3c52 6f77204d 414e5546 41435455 52455249 443d2237 30362220 4d414e55 46414354 55524552 3d22412d 445a4722 2049534c 4f434b4d 414e5546 41435455 5245523d 22462220 49535645 4849434c 453d2246 223e3c2f 526f773e 3c526f77 204d414e 55464143 54555245 5249443d 22333138 22204d41 4e554641 43545552 45523d22 412e522e 452e2220 49534c4f 434b4d41 4e554641 43545552 45523d22 46222049

any help would be greatly appreciated.

  • 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-26T19:48:04+00:00Added an answer on May 26, 2026 at 7:48 pm

    I don’t see anything that immediately sticks out in your code as wrong.

    The NSLog() is printing an NSData object, which is binary data so the hexadecimal numbers you are seeing are the representations of the bytes which is exactly what you would expect.

    The NSData Class Reference:

    description

    Returns an NSString object that contains a hexadecimal
    representation of the receiver’s contents.

    • (NSString *)description

    Return Value

    An NSString object that contains a hexadecimal representation of the receiver’s contents in
    NSData property list format.

    If you want to print out the string representation of this data, use:

    NSString *capturedResponseString = [NSString stringWithUTF8String:[capturedResponseData bytes]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

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 use svn to find a checkin using svn log, but it
I am trying use std::copy to copy from two different iterator. But during course
I am trying use Thread but i have some problem (I am beginner at
Im trying use a Java annotation in a Groovy class but have trouble to
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Hi I'm trying use a datepicker on a field I have. I'm trying to
Trying to use Powershell to script the removal of specific custom errors from 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.