Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19969] iOS: Problem with suffix like @2x, ~iphone in ImageView source with app-thinning enabled

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-01-11T21:24:12.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsappthinning, imageview, qe-5.4.0
ReporterFokke Zandbergen
AssigneeChee Kiat Ng
Created2015-11-13T10:15:33.000+0000
Updated2016-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

FileDateSize
imagefile.zip2015-11-13T10:15:31.000+000010295850

Comments

  1. Chee Kiat Ng 2016-01-07

    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
       Ti.UI.createImageView({
       	image: 'images/foo@2x.png'
       })
       
    That's where the bug is. changing title.
  2. Chee Kiat Ng 2016-01-07

    Another issue is, it can't process @2x. It can only accept image: '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.
  3. Fokke Zandbergen 2016-01-07

    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 simply images/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.
  4. Chee Kiat Ng 2016-01-07

    [~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.
  5. Chee Kiat Ng 2016-01-08

  6. Josh Longton 2016-07-26

    Verified as fixed, I am now able to access images with suffix when app thinning is enabled. Tested on:
       iPhone 6s (9.3.1) 
       iOS simulator (9.3)
       
Mac OSX El Capitan 10.11.6
       Studio: 4.7.0.201607130543
       
Ti SDK: 5.4.0.v20160725003348
       
Xcode: 7.3.1 
       
Appc NPM: 4.2.7
       Appc CLI: 5.4.0-35
       Node: v4.4.4
       
    *Closing ticket*

JSON Source