提交时表单视图触发错误

时间:2018-10-10 17:43:08

标签: nativescript

我对NativeScript非常陌生(几个小时),我正尝试按照其网站上的教程进行操作。在本教程的第12步运行代码时,该应用程序失败(仅当我提交登录表单时),并因以下错误堆栈而崩溃:

2018-10-10 20:35:06.321 nsplaydev[2295:419329] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: user.login is not a function. (In 'user.login()', 'user.login' is undefined)
at 
1 signIn@file:///app/views/login/login-page.js:17:15
2 notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:110:31
3 _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:127:24
4 tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:207:24
5 UIApplicationMain@[native code]
6 start@file:///app/tns_modules/tns-core-modules/application/application.js:272:26
7 run@file:///app/tns_modules/tns-core-modules/application/application.js:300:10
8 anonymous@file:///app/app.js:2:22
9 evaluate@[native code]
10 moduleEvaluation@[native code]
11 @[native code]
12 promiseReactionJob@[native code]
', reason: '(null)'
*** First throw call stack:
(0x211e5bf78 0x211054284 0x102e67e60 0x102e8d2e4 0x10378f088 0x1037901b4 0x21104f900 0x23f731a98 0x23f19be18 0x23f19c14c 0x23f19b0ec 0x23f76d208 0x23f76e468 0x23f74cb70 0x23f81d024 0x23f81fb50 0x23f81fec8 0x23f81854c 0x211de8a50 0x211de89cc 0x211de8284 0x211de2f64 0x211de2844 0x214091be8 0x23f73031c 0x103790044 0x10378e7a4 0x10378e26c 0x102e45630 0x103440e14 0x103449a24 0x103449a34 0x103449a34 0x103442ee0 0x1033dc198 0x1033b1e94 0x103546b9c 0x102e5a354 0x1035e2964 0x10344a494 0x103449a34 0x103449a34 0x103449a34 0x103442ee0 0x1033dc198 0x1033b1e94 0x103546c80 0x1035de8e0 0x102e51898 0x102e97f50 0x102ac8198 0x10257d3dc 0x211898020)
libc++abi.dylib: terminating with uncaught exception of type NSException
2018-10-10 20:35:06.321 nsplaydev[2295:419329] PlayLiveSync: Uncaught Exception

要学习该框架,我故意手动键入每一行以进行学习。认为可能导致错误,所以我回过头来复制并粘贴了他们的确切代码。仍然有问题。

更新:本教程的链接为here

谢谢

1 个答案:

答案 0 :(得分:0)

基于错误日志,看来您尚未在视图模型中定义登录功能。