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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:08:20+00:00 2026-05-23T07:08:20+00:00

I have a NSURLConnection which I am calling every time -(void)viewWillAppear:animated is called (that’s

  • 0

I have a NSURLConnection which I am calling every time -(void)viewWillAppear:animated is called (that’s only for now, it’s just for testing)

I am doing it like this

receivedData = [[NSMutableData data] retain];
NSString *urlString = @"<URL hidden>";
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30.0];
[NSURLConnection connectionWithRequest:request delegate:self];

Then I have these three delegate methods:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    [receivedData appendData:data];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    NSString *returnString = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding];
    usersPhotos = [[NSMutableArray alloc] initWithArray:[[returnString JSONValue] objectForKey:@"data"]];
    [self loadAnnotations];

    NSLog(@"%@", returnString);

    [returnString release];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    [self loadAnnotations];
}

Even though I am sure the returnStringshould change (I can visit the site in urlString and confirm it has changed) it is always the same.

It is as if it reuses the data that it retrieves from the first connection.

Does anyone know why this is?

  • 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-23T07:08:21+00:00Added an answer on May 23, 2026 at 7:08 am

    it should be your cache policy, i will update in a second with the correct info.


    UPDATE

    Try setting your cahce policy to: cachePolicy:NSURLRequestReloadIgnoringCacheData

    It should be:

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using NSURLConnection's sendAsynchronousRequest:queue:completionHandler: method which is great. But, I now need
I have a NSURLConnection which is a post to the server, but I expect
I have been playing around with NSURLConnection. Now I'm trying to grab some data
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a class WebServiceCaller that uses NSURLConnection to make asynchronous calls to a
I am developing one small app in which i have multiple NSURLConnection.I have created
I have a function, in UpdateViewController, that is being called by a delegate, MyDownloadController,
I have multiple views which make the same NSURLRequest/NSURLConnection request . Ideally, in order
An iPhone question for you guys! I have an NSURLConnection that downloads XML from
Short Intro Currently I have a UITableView which is filled with custom cells that

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.