Creation for iOS 7+, Based on Xcode 6.1, Using the Amazon AWSiOSSDKv2 2.0.12 SDK, Testing on iPhone 5 and iPad 2
I upload images from my Amazon S3 bucket using the Amazon SDK for iOS. Downloading works fine, but I want to use the ifModifiedSince property to retrieve only images that have changed since a specific date (see http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AWSS3GetObjectRequest.html#//api/ name / ifModifiedSince )
However, this does not work. Even when I specify the date of ifModifiedSince, which LATER THAN changed the file date to S3, the file is returned.
According to Amazon documentation: ifModifiedSince -
It returns an object only if it has been modified since the specified time, otherwise it returns 304 (not changed).
So I'm not sure if I am doing something wrong, or Amazon has an error in the SDK.
Here is my code:
-(void)downloadPhotoWithName:(NSString*)name completed:(retrievedImage)completed { NSFileManager *manager = [NSFileManager defaultManager]; NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cacheDirectory = [cachePaths firstObject]; NSString *filename = [NSString stringWithFormat:@"%@.jpg", name]; NSString *filePath = [cacheDirectory stringByAppendingPathComponent:filename]; AWSS3 *transferManager = [AWSS3 defaultS3]; AWSS3GetObjectRequest *profilePhoto = [[AWSS3GetObjectRequest alloc] init]; profilePhoto.bucket = S3BUCKETNAMEIMAGE; profilePhoto.key = filename; if ([manager fileExistsAtPath:filePath isDirectory:NULL]) { NSDictionary *att = [manager attributesOfItemAtPath:filePath error:nil]; if (att) {
source share