ohsc/TGJSBridge

Possible Guidance with Cache?

Closed this issue · 2 comments

How would one disable cache for the UIWebview that is created for this library?

For a standard UIWebview, there are these options:
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];

Seems like this works:

+ (id)jsBridgeWithDelegate:(id <TGJSBridgeDelegate>)delegate
{
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    [[NSURLCache sharedURLCache] setDiskCapacity:0];
    [[NSURLCache sharedURLCache] setMemoryCapacity:0];
    TGJSBridge* bridge = [[TGJSBridge alloc] init];
    bridge.delegate = delegate;
    return bridge;
}```
ohsc commented

yes, cache is part of NSURLCache. It's not belong to bridge.
You may use NSURLCache in the viewController.