No config.adapter.idAttribute specified for table "books" in Titanium Appcelerator

StackOverflow https://stackoverflow.com/questions/21800796

  •  12-10-2022
  •  | 
  •  

Question

I am new very new to appcelerator. And while following quick start guide, I cannot produce the build on iOS simulator, even after exactly copy pasting the code in the required models and controllers. Console gives me following info:

  • No config.adapter.idAttribute specified for table "books"
  • Adding "alloy_id" to uniquely identify rows

Simulator stops at the default splash screen and nothing happens after that. Can gurus walk me through this?

Was it helpful?

Solution 2

Are you stuck at the first build stage? If so check out my answer here:

Appcelerator Dev Questions - favebooks tutorial

It's because nothing is being called to launch the app when it initially loads so it hangs at the splash screen, the model is fine, it's the index.js and index.xml you need to look at.

OTHER TIPS

When you edited controllers/index.js you probably erased everything that was there and not only the doClick() function. You need to leave $.index.open(); at the end of the file, or you will get No config.adapter.idAttribute specified for table "books" error

Your code should look like this:

var myBooks = Alloy.Collections.books;
var book = Alloy.createModel('books', { 
 title : 'Great Expectations', 
 author: 'Charles Dickens' 
});
myBooks.add(book); 
book.save();
$.index.open();

Hope this helps

Do you have add idAttribute in your model like this ?

Model exemple :

 exports.definition = {
    config: {
        columns: {
            "id":"integer",
            "version": "integer"
        },
        adapter: {
            type: "sql",
            collection_name: "version",
            idAttribute:'id'
        }
    },
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top