Is it possible to prevent an NSURLRequest from caching data or remove cached data following a request?

Usually it’s easier to create the request like this 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; }

Storing custom objects in an NSMutableArray in NSUserDefaults

For loading custom objects in an array, this is what I’ve used to grab the array: NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults]; NSData *dataRepresentingSavedArray = [currentDefaults objectForKey:@”savedArray”]; if (dataRepresentingSavedArray != nil) { NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingSavedArray]; if (oldSavedArray != nil) objectArray = [[NSMutableArray alloc] initWithArray:oldSavedArray]; else objectArray = [[NSMutableArray alloc] init]; } You should check … Read more