message ="'undefined'不是钛中的函数(评估'bookview.open()')"

Nai*_*ung 4 titanium titanium-mobile titanium-alloy

我是TitaniumMobile的新手,我目前正在接受官方教程,但我还是在做这个阶段

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

当我尝试使用ios模拟器运行时,我有点困在上面的阶段,并发生以下错误.

  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] :  }
Run Code Online (Sandbox Code Playgroud)

小智 9

确保bookdetails是一个窗口而不是视图.

要检查,只需打开bookdetails.xml并检查Window的标签是否存在.