{ "id": "163228", "key": "TIMOB-23914", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2018-08-13T18:56:44.000+0000", "created": "2016-09-15T15:01:09.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-08-13T18:56:44.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13715", "name": "Hyperloop", "description": "Hyperloop project" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" }, { "id": "10207", "name": "Tooling" } ], "description": "requesting an image placed in assets/images with \r\n{code:java}\r\nUIImage.imageNamed\r\n{code}\r\n\r\nreturns null when the expected result is a reference to the image. ", "attachment": [], "flagged": false, "summary": "Hyperloop - iOS: UIImage.imageNamed returns null ", "creator": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1065, "state": "closed", "name": "2016 Sprint 17 SDK", "startDate": "2018-08-13T17:39:36.846Z", "endDate": "2018-08-27T17:39:00.000Z", "completeDate": "2018-08-29T16:10:57.013Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "396225", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Can you try putting the image in app/assets/iphone (Alloy) and Resources/iphone (Titanium classic)?. Referance: http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Hyperloop_Programming_Guide-section-46253491_iOSHyperloopProgrammingGuide-Functionpointers. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-09-15T15:43:29.000+0000", "updated": "2016-09-15T15:43:29.000+0000" }, { "id": "396228", "author": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "body": "already did it and the result is the same.\r\n\r\nEDIT: \r\n\r\nThe images must be placed in src folder and the src folder needs to be required in appc.js otherwise the files in src are ignored.\r\nanyways it would be great to use images placed in assets/images to avoid duplicating files", "updateAuthor": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-15T16:03:36.000+0000", "updated": "2016-09-16T09:01:40.000+0000" }, { "id": "396360", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Please provide a sample code that you are testing. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-09-16T16:36:09.000+0000", "updated": "2016-09-16T16:36:09.000+0000" }, { "id": "396379", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~bgarcia] So placing them in /src works? Can you provide a workaround here, so people can use that one until we adjust the core with it? Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-16T20:46:43.000+0000", "updated": "2016-09-16T20:46:43.000+0000" }, { "id": "396438", "author": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes! just place any image in /src folder and make sure that you are requiring the src folder in appc.js with any framework. It can be in the form\r\n{code:javascript}\r\nthirdparty : {\r\n 'dummyFramework' : {\r\n source : ['src'],\r\n header : 'src',\r\n resource : 'src'\r\n }\r\n}\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-17T13:37:44.000+0000", "updated": "2016-09-18T10:45:05.000+0000" }, { "id": "396458", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thank you! The effort of this ticket should be that the Hyperloop CLI is able to search assets (not only images) in:\r\n- Resources/ (for classic projects)\r\n- app/assets/ (for Alloy projects)\r\n- src/ (for Hyperloop-projects - without manual framework linking)\r\n\r\nI guess the CLI for that should be pretty straight-forward. I would actually say that people should only place assets in the first two directories and only place frameworks in src/. And since we already copy the assets of the first two directories, the real problem is that the names of the images in the asset catalogs are hashed, so calling them with the \"real name\" causes problems. [~cbarber] any idea here? For now, I would provide a new util-method in [hyperloop-utilities|https://github.com/appcelerator/hyperloop-utilities] but that can't be a long-term solution.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-18T10:48:22.000+0000", "updated": "2016-09-18T11:08:40.000+0000" }, { "id": "396466", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I agree, don't put images or other non-source files in {{src}}. Put them in {{Resources}} or {{app/assets}}.\r\n\r\nAsset catalogs are only enabled if {{}} is true in the {{}} section of the {{tiapp.xml}}. It is true by default.\r\n\r\nThe generated asset catalog image set's name is just the sha1 of the image's filename including extension without any {{\\@2x}}/{{\\@3x}} or {{~iphone}}/{{~ipad}} tokens. It should be pretty easy to figure out. Look at the iOS build for clues: https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L5269.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-09-18T15:51:25.000+0000", "updated": "2016-09-18T15:51:25.000+0000" }, { "id": "440706", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "For everyone stumbling across this issue, there is a temporary workaround as [~cbarber] mentioned above.\r\n\r\nGenerate the SHA-1 hash of the image, e.g.\r\n{code}\r\n~ ❱❱❱ echo -n \"assets/images/tab1.png\" | shasum\r\nf58b0d04f3ad524648680e9940fb4e77323cb9bb -\r\n{code}\r\n\r\nCreate the image in Hyperloop\r\n{code}\r\nconst UIImage = require('UIKit/UIImage');\r\nconst image = UIImage.imageNamed('f58b0d04f3ad524648680e9940fb4e77323cb9bb');\r\n{code}\r\n\r\nYou could use a simple JS object map to avoid using the hashes throughout your code and access them with descriptive keys.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-13T18:54:35.000+0000", "updated": "2018-08-13T18:54:35.000+0000" }, { "id": "440707", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Btw, this will be resolved in SDK 8.0.0 as part of [this PR|https://github.com/appcelerator/titanium_mobile/pull/10239]. Cheers!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-13T18:56:44.000+0000", "updated": "2018-08-13T18:56:44.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }