Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

ACS Custom Objects

$
0
0

Hi,

I have an ACS mobile app that creates a custom object from a locally stored record. If the custom object is stored it updates the local record with the custom_object.id. The code is below and seems to work find ( I get a complete object back when the create is successful).

Cloud.Objects.create({
    classname: 'activities',
        fields:{
            info: er.info,
            met: er.met,
            mut: er.mut,
            place_id: er.pid,
            coordinates: [gps[0],gps[1]]
    }    
   }, function (e) {                                
    if (e.success) {
        var activity = e.activities[0];
        Ti.API.info(activity);
        erm.set({'eid': activity.id, mut: activity.mut}).save();
    }
    else{
        Ti.API.info(e);
    }
 
});
erm is an alloy model and er is the JSON of the model

This all works fine and it updates my model as I would expect and the Ti.API.info(actvity) shows the returned new activity as I would expect.

The problem I have is that I cannot see this custom object in the ACS portal (my.appcelerator.com/apps) for my app and if I do a query in the mobile app like:

Cloud.Objects.query({
    classname: 'activities',
    page: 1,
    per_page: 100
}, function (e) {
    if (e.success) {
        alert('Success:\n' +
            'Count: ' + e.activities.length);
        for (var i = 0; i < e.activities.length; i++) {
            var a = e.activities[i];
            alert('id: ' + a.id + '\n' +
                'make: ' + a.info + '\n' +
                'created_at: ' + a.created_at);
        }
    } else {
        alert('Error:\n' +
            ((e.error && e.message) || JSON.stringify(e)));
    }
});
It returns success but count is 0 - anyone know what I have done wrong and where my custom objects have gone ?

Did I forget to 'flip a switch' somewhere?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>