I am developing a Titanium app with events and tasks, and I want those to be synced to cloud storage so the user can access their events and tasks from any app or browser as long as they provide their login.
It appears that Appcelerator/Titanium makes this all very easy, and yet they are awful at documenting it. Perhaps I don't understand. So can anyone confirm or correct the picture I've painted below?
A Titanium Alloy app allows you to create models by defining them in JSON files in the /models folder. If you specify a property for this object as follows:
adapter: {type:'acs'}
... then it appears that Alloy will store the object in ACS whenever you call the .save() command on the object.In order for this to work you must of course make your app connect to ACS, which you do by clicking the button "Cloud-enable" in tiapp.xml's graphic interface. And you will of course have to make sure that the app logs into ACS with a particular username-password combination.
If I look at my sources optimistically, this appears to be all you need to do. Those sources are:
But then I see everyone referring to an example project by Aaron Saunders, which has a few custom files in it that seem to build on top of Alloy in order to make this adapter:{type:'acs'} thing possible. To see what I am talking about, go to the app/assets/alloy/sync folder and check out the acs.js file there. Also, a Q&A answer by Tony Lukasavage from a year ago says there is currently no built ACS sync adapter for Alloy. He points to Aaron Saunders' project http://alloylove.com/# for solutions.
So what's going on? Is it indeed all built into Alloy/Backbone and just not documented anywhere and is Aaron Saunders using built in stuff for an example project, or do I need to include Aaron's code in my project in order for it all to work?
Thanks for any tips! Wytze
Note to self: also try out this example, which requires creating a new project: https://wiki.appcelerator.org/display/td/11.+Storing+data+in+ACS
Okay, so I figured it out. The "easy" examples where all you have to do is add adapter: {type:'acs'} to your object definition in order to sync it to ACS is indeed dependent on Aaron Saunders' example code. His best explanation is here: https://github.com/aaronksaunders/ci.alloy.adapter.two
If you want to use his stuff, basically you just need to copy two files from his project to your own project: app/alloy.jmk (this does some fancy filename rewriting that I don't fully understand) app/assets/alloy/sync/acs.js (this is the core of his stuff)
It seems promising to me, but for now I think I will just be creating my own objects in my own way and then syncing them to ACS using the regular Ti.Cloud methods.