Message = "'undefined' is not a function (evaluation of 'bookview.open ()") in titanium

I am new to TitaniumMobile and I am currently following official tutorials , but I hit at this point

function showBook(event) {
    var selectedBook = event.source;var args = {
        title: selectedBook.title,
        author: selectedBook.author
    };
    var bookview = Alloy.createController("bookdetails", args).getView();
    bookview.open();
}      

When I tried to work with the ios simulator, I was kind of stuck in the above stage, and the following error occurred.

  Script Error {
[ERROR] :      backtrace = "#0 () at :0";
[ERROR] :      line = 27;
[ERROR] :      message = "'undefined' is not a function (evaluating 'bookview.open()')";
[ERROR] :      name = TypeError;
[ERROR] :      sourceId = 344963552;
[ERROR] :      sourceURL = "file:///Users/hivelocity/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/6B8062FB-B379-407A-8553-184EED274850/FaveBooks.app/alloy/controllers/index.js";
[ERROR] :  }
+4
source share
1 answer

make sure bookdetails is a window, not a view.

To check, just open the bookdetails.xml file and check the Window tag or not.

+9
source

Source: https://habr.com/ru/post/1546832/


All Articles