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

Collections in iOS background service?

$
0
0

Hello all,

For iOS I am trying to create a background service that gets data from a remote server and puts/adds that data into a(n existing) local database.

For this I would like to get a Collection, perform .where({property: value}), add the new data to the collection and save it.

However, iOS does not simply allow this.

I tried the following to start with:

var Alloy = require('alloy');
 
var vacancies = Alloy.Collections.vacancies;
vacancies = vacancies.where({is_seen: 0});
Error: undefined is not an object (evaluating 'vacancies.where')

As an alternative I have tried to pass the collection via Ti.App.Properties, but I still wasn't able to do anything with the collection other than looping through it like an array.

Is there a way I can still play with the collections and perform actions on it as if it is a controller? If not, how can I alternatively achieve this?

I hope this is enough information.

Thanks in advance,

~ Bryan


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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