[TIMOB-16200] ACS: Cache problem in ACS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | kazuaki konno |
Assignee | Unknown |
Created | 2013-12-19T11:41:01.000+0000 |
Updated | 2018-02-28T20:04:15.000+0000 |
Description
CCPhoto.m Line:227
-(NSString *)localPathForPhotoSize:(NSString *)photoSize
{
return [NSString stringWithFormat:@"%@/%@_%d", [Cocoafish defaultCocoafish].cocoafishDir, self.objectId, photoSize];
}
ACS photos can not update if the photo id is the same.
When we were developing Facebook like SNS, we used photos on ACS for the user's profile. And we tried to change the photo, but it didn't. So looked into the source and found the problem.
Line: 215
-(UIImage *)getImageForPhotoSize:(NSString *)photoSize;
This method cache photo data. And it will be used objectID for the cache data path.
When user in ACS updated the photo, photo's objectID will not be changed and only photo itself will be replaced. The cache and loading cache by getImageForPhotoSize: method can not be used because this tries to use the existing cache unless the objectID wouldn't change.
So we fixed as following;
-(NSString *)localPathForPhotoSize:(NSString *)photoSize
{
return [NSString stringWithFormat:@"%@/%@_%@", [Cocoafish defaultCocoafish].cocoafishDir, self.md5, photoSize];
}
We used md5 instead of objectID.
And as follwoing, there is also the problem.
Line:207
-(NSString *)localPath:(PhotoSize)photoSize
{
if (photoSize < CC_SQUARE_75 || photoSize > CC_ORIGINAL) {
[NSException raise:@"Invalid Photo Size" format:@"Unknown photo size",photoSize];
}
return [NSString stringWithFormat:@"%@/%@_%d", [Cocoafish defaultCocoafish].cocoafishDir, self.objectId, photoSize];
}
So we changed to use md5 instead of objectID.
-(NSString *)localPath:(PhotoSize)photoSize
{
if (photoSize < CC_SQUARE_75 || photoSize > CC_ORIGINAL) {
[NSException raise:@"Invalid Photo Size" format:@"Unknown photo size",photoSize];
}
return [self localPathForPhotoSize:[CCPhoto getPhotoSizeString:photoSize]];
}
Thanks for reporting this problem. Engineering is going to review this issue and provide an update shortly.