ios7nsurlrequestnsurlrequestcachepolicy

NSURLRequest cache issue iOS 7


in iOS 7 cachePolicy doesn't work, it just cache the downloaded json.

//URLRequest
        NSString *url = [NSString stringWithFormat:@"http://www.semhora.com/jsonparser/categories/categories_%d_test.json", _categoriesIndex];
        NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:url]
                                                  cachePolicy:NSURLCacheStorageNotAllowed
                                          timeoutInterval:60.0];

How can I disallow cache in iOS 7?


Solution

  • I just used:

    //URLRequest
            NSString *url = [NSString stringWithFormat:@"http://www.semhora.com/jsonparser/categories/categories_%d_test.json", _categoriesIndex];
            NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:url]
                                                      cachePolicy:0
                                              timeoutInterval:60.0];
    

    And now it works, got any answer from apple dev forum until now why it happens.