[TIMOB-4233] iOS: Provide mechanism for module resources to be placed in the application bundle root folder
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 1.7.0, Release 1.8.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Jeff English |
Assignee | Pedro Enrique |
Created | 2011-05-26T19:14:37.000+0000 |
Updated | 2015-09-23T05:08:05.000+0000 |
Description
Module assets that are placed in the module's Assets folder are packaged into the application bundle in the modules/ folder. Modules requiring access to those resources then must be coded to reference their NSBundle resources in that folder rather than the application's root bundle. The other option is to require the developer to manually copy the resources needed by the module into the Resources folder in the application project.
For modules where we can modify the source code, the module developer must update all references to loading resources to use the correct folder location. For modules where we do not have access to the source code (ie. only a library is provided) it is not possible to modify the source code and the module developer must ensure that resources are placed into the application's resource bundle. This can cause problems and issues when this is not done properly.
There should be a mechanism that allows the module developer to specify resources that should be packaged into the application bundle root folder. That would allow modules to be more turn-key and eliminate issues that result when resources are not in the proper location. One possibility is to allow the developer to place these assets into the "Resources" folder (rather than the "Assets" folder) in the module folder. During the build process for the application, resources located in the "Resources" folder of a module are placed into the root of the application bundle rather than the modules/ folder.
The latter suggestion about using the "Resources" folder would match what was originally done with the Bump modules. There is a Resources folder in that module and the build.py script was modified to copy the Resources folder in addition to the assets and documentation folder. The resulting module zip file then contains the Resources folder. The application build step would then copy the files in the Resources folder into root of the application bundle. This would require a change the build.py script template, builder.py, and compiler.py scripts
After several discussions, it has been determined to NOT copy module resources into the application bundle's root folder. File name collisions are a potential problem and it is better to let the application developer identify those collisions when copying them over manually rather than doing it automatically and creating issues with the wrong file being used.
This problem continues to come up about once a month. We should define a way for a module to specify that it has assets that should be copied into the root of the applications' bundle. Perhaps under the 'platform' folder. The issue about possible naming collisions can be handled by having the build script throw an error if the file already exists or just issue a warning message about possible file name collisions. See http://developer.appcelerator.com/question/142714/where-to-put-ios-resources-in-a-module-such-that-they-are-accessible-later for an example of the customer issue.
Ingo, I am reopening this so that it can be re-evaluated / discussed as an improvement due to regular developer issues with assets.
Has there been any resolution to this problem? I have a client issue where I am writing a module and the xib file for the library is not getting loaded I guess because it is not included in the application resource bundle. Is there a resolution? In this case, I have access to the library and can modify the source code. Thanks
No changes have been made to support this as of yet. Since you have access to the source: 1. Add the compiled nib file to the 'assets' folder of the module 2. Modify the module source to locate its resources in @"modules/
thanks will take a look there
Placing this in 3.3.0, but we might want to do this as part of reworking the module build scripts to work with the new CLI, no?
Yes, that would be a good time to do it.