titanium app.js getting overwritten when building - iphone

I'm using Appcelerator Titanium to create a mobile app.
The problem I've having is that my entire Resources directory is getting overwritten each time I build my project. Any reason why? It makes it so I can't edit app.js (which is in that directory) to include my global functions file.

Sounds like you are using the Alloy framework in Titanium. With Alloy you dont modify the app.js, it is autogenerated for you. Modify the code, styles, and view files inside of the app/ directory.
Check here for more documentation about alloy.

Related

How to deploy using Hostinger?

I got an assignment to create a simple app and to deploy it in a website.
During development I was using xampp and never had an issue.
I do not know how to format folder directories but here I go. I have index and libs (folder) at same hierarchy, inside libs I have 3 folders, for css, js and php.
One file inside css, jQuery and scripts inside js and 3 files calling different apis inside php.
My first time hosting a website so I youtubed how to do it. however, I cannot get it to work properly.
I get the following error:
Failed to load resource: the server responded with a status of 404 ()
and it points to my jQuery and js file.
I have tried every "solution" available but nothing has been improved.
If anyone knows what is causing this can you please let me know or point towards some documentation so that I can fix it.
Thank you
I have found the issue.
The folder inside were in upper case and it causes an issue because the path was case sensitive.
By changing the path to JS instead of js and PHP opose to php, it was able to find the file

Multi-page Airconsole controller?

I'm just starting to create a controller for use with Airconsole. I'd like it to be somewhat complicated and will be using Angular to create different pages.
In Unity, I can drag in a controller.html file. However, I've been getting resource not found errors when I try to access say controller.js or controller.css. How can I upload multliple files to the Airconsole host? Is there a general pattern used by other games?
So far I'm considering
hosting my app separately and just redirecting to my separate web page. This seems to give errors in the emulator though.
Compiling the entire app into just one HTML file.. Not sure how to get these entirely into one file. When I run ng build I get a smaller dist compiled file, but it still consists of several smaller files. Will try dragging that into Unity and trying again. But dragging the entire Angular project inside Unity felt like a really bad idea..
Link to files hosted on separate pages but still have the uploaded HTML file do something.. But not sure how much I need to do here vs how much I can move to other files that I host.
You can create your controller using controller.html with Angular (1?!), have different pages (e.g. via ng-include and the angular routing module) and upload everything to AirConsole (developers).
By using ng-include you can have multiple .html views you dynamically load into the controller.html.
I once wrote an example app for AirConsole and Angular:
https://github.com/francois-n-dream/airconsole-angular-phaser
Just think of it as if you would make a (mobile) website which in addition uses the AirConsole API for device communication.
My basic "how to include other files" question was answered well by another question: How to include js and css.
For the more generic question of working with Angular, I still haven't quite figured it out. But what I'm doing at the moment:
I have an Angular project outside of Unity. I run ng build to compile everything into a folder dist. Then two options work:
Deploy the dist folder to static file hosting and change index.html's relative links to point to the separately hosted files with <base href="https://cloudfilehosting/airconsole-host/">
OR
Copy the dist folder into Unity's Assets/WebGLTemplates/AirConsole folder.

Using DateJS in Ionic

In my web app i use datejs now i am building a mobile app with ionic and i wanted to use the same datejs but i realised that the total size of my app more than doubled when i included datejs.
So i looked into the datejs folder and i realised that even for the build there are a whole lot of files apart from the date.min.js, now i assume it is these files that are making my app bulky (from 2.6MB to 6.3MB), i would like to take them out by i do not know if the main date.min.js file is dependent on them.
Here is a screenshot of the datejs folder structure:
Inside the build folder:
And inside the production folder:
As you can see for a build there appear to be so many files, my main reason for using datejs and not the date filter in angularjs was because i tried performing an operation that kept on given me the date as "undefined" when i used the angularjs date filter no matter what i did, however when i switched to using datejs that issue was resolved.
The date.min.js is not dependent on the country specific files. You only require date.min.js.
Hope this helps.

Accessing files in Documents folder via jqtouch in iphone app

I was able to save some files in the Documents folder on my app. How can I access them on the phonegap side of things with jqtouch/javascript/html. I want to do something like:
$('#intro').attr('src','../../Documents/logo.png');
But, apparently, it's not letting me go up all those directories outside of www.
How can I resolve this?
There is a bundle file reader plugin, but it seems to read the contents, not reference it.
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/BundleFileReader
Not sure you can do what you are asking about. Perhaps you could use the PhoneGap File API to save the files somewhere within your www dir instead? Then they would be available via html/js.

How can I add third party images to be used in the Phonegap Framework in Xcode

How can I add third party images to be be used in the Phonegap Framework in Xcode?
I have a few images to include.
The linking to the various websites work but the images are not showing, it is just a question mark.
<li>Google<img src="googlelogo.png"/>
Please help. Thank you :)
I'm assuming that you want to refer to an image that you include with your PhoneGap project. Just make sure any images you want to reference are included inside the www folder of your project.
Think of the www folder like you would a directory on a server somewhere. Your index.html page sits on the root, and you can create any number of sub-directories you'd like... just as you would on a regular server.
<li>Google<img src="googlelogo.png"/>
The above code suggests you have a file at: www/googlelogo.png
<li>Google<img src="myImages/googlelogo.png"/>
The above code suggests you have a file at: www/myImages/googlelogo.png