4

My iOS App rejected by Salesforce security review team with following reason.

"Insecure Storage of Sensitive Data" and show this file path /private/var/mobile/Applications/96998CD5-5C0F-490C-8E2C-FD8835F2014E/Library/Caches/com.companyname.appname/Cache.db-wal

So how to prevent chaching to resolve this issue.

Please help me I would like to submit my app to Salesforce security review team again ASAP.

5

I presume this is a native app built using the Force.com Mobile SDK for iOS. This is a standard iOS procedure to disable caching on your NSURLRequest

Some sample code as provided here

NSURLRequest *request = [NSURLRequest requestWithURL:url
      cachePolicy:NSURLRequestReloadIgnoringCacheData
      timeoutInterval:60.0];

Then create the connection

NSURLConnection *conn = [NSURLConnection connectionWithRequest:request
       delegate:self];

and implement the connection:willCacheResponse: method on the delegate. Just returning nil should do it.

- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse {
  return nil;
}
1

Gaurav's answer didn't quite do it for me, so I figured I'd add my 2 cents.

I observed that the caches were persistently being saved in the app's Library/Caches/<company app identifier>/Cache.db-wal. Even after setting the cache policy of the request, it continued to store data here. I was able to resolve the issue by wiping out this file after each request.

+(void)destroyNetworkCache {

    NSString *caches = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, TRUE) objectAtIndex:0];
    NSString *appID = [[NSBundle mainBundle] infoDictionary][@"CFBundleIdentifier"];
    NSString *path = [NSString stringWithFormat:@"%@/%@/Cache.db-wal", caches, appID];
    [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.