[TIMOB-19969] iOS: Problem with suffix like @2x, ~iphone in ImageView source with app-thinning enabled
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-01-11T21:24:12.000+0000 |
Affected Version/s | Release 5.1.0 |
Fix Version/s | Release 5.4.0 |
Components | iOS |
Labels | appthinning, imageview, qe-5.4.0 |
Reporter | Fokke Zandbergen |
Assignee | Chee Kiat Ng |
Created | 2015-11-13T10:15:33.000+0000 |
Updated | 2016-07-26T23:15:26.000+0000 |
Description
The attached sample project demonstrates that with app-thinning enabled, you cannot include a suffix in the image path. This works fine with app-thinning disabled.
1. Build the project with app-thinning enabled and confirm you see the placeholder image
2. Open tiapp.xml
and change use-app-thinning
to false
3. Build the project again and confirm you see the image.
The code where we hash the image path should strip out any suffixes (including ~iphone
etc).
Attachments
Actually, it's nothing to do with the suffix. It's because it's located in "Resources/iphone/images/foo@2x.png" But the iOS SDK was treating it as "Resources/images/foo@2x.png" when it saw this code
That's where the bug is. changing title.
Another issue is, it can't process
@2x
. It can only acceptimage: 'images/foo.png'
if app-thinning is enabled. but this may not necessarily be a bug, because when you create image view, it is supposed to find the appropriate resolution image to use that is consistent with the device, so there shouldn't be a need to indicate@2x
in the first place.Your last comment is what I created this ticket for, but are you sure about your preceding comment that you now changed the title of the ticket to? When I use the attached test app (which indeed has the image in
iphone
) and modify log what we use [to calculate the hash for the catalog name](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L5050) I don't see it including the platform specific path. It's simplyimages/foo.png
. Coming back to the original issue, I think the problem is [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIImageView.m#L507-L521) (and [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/ImageLoader.m#L514-L526)) where we don't strip out suffixes like [we do when we create the asset catalog names](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L5031), which means it won't be found.[~fokkezb] Sorry i misunderstood the ticket. I understand now after your comment about the suffix. My observation on the preceding comment was also erroneous. I was using the new method 'getAsset' that did not manage the path before hashing. Reverting the title and will look at this ticket.
Verified as fixed, I am now able to access images with suffix when app thinning is enabled. Tested on:
*Closing ticket*