Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSURL -resourceDataUsingCache: seems to ignore the flag... #160

Closed
gcasa opened this issue Oct 23, 2020 · 3 comments
Closed

NSURL -resourceDataUsingCache: seems to ignore the flag... #160

gcasa opened this issue Oct 23, 2020 · 3 comments
Assignees

Comments

@gcasa
Copy link
Member

gcasa commented Oct 23, 2020

NSURL -resourceDataUsingCache: seems to ignore the flag... is this on purpose?

- (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
{
  NSURLHandle	*handle = [self URLHandleUsingCache: YES];
  NSData	*data = nil;

  if ([handle status] == NSURLHandleLoadSucceeded)
    {
      data = [handle availableResourceData];
    }
  if (shouldUseCache == NO || [handle status] != NSURLHandleLoadSucceeded)
    {
      data = [handle loadInForeground];
    }
  if (nil == data)
    {
      data = [handle availableResourceData];
    }
  return data;
}
@rfm
Copy link
Contributor

rfm commented Oct 23, 2020

It does use the flag:

if (shouldUseCache == NO || [handle status] != NSURLHandleLoadSucceeded)

The flag controls whether cached data is returned, not whether a cached URL is used to supply it.
So yes, I believe this is intentional.

@gcasa
Copy link
Member Author

gcasa commented Oct 24, 2020

Shouldn't the call to

  NSURLHandle	*handle = [self URLHandleUsingCache: YES];

also use this?

@gcasa
Copy link
Member Author

gcasa commented Oct 24, 2020

Ok, I am closing this.

@gcasa gcasa closed this as completed Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants