1

tns コア モジュール 2.2.0 および angular rc4 (telerik によって公式にリリースされたバージョン) に更新すると、アプリがサーバーに対して http 呼び出しを行うことができなくなり、このエラーが発生し続けます。

com.tns.NativeScriptException: 
Calling js method onClick failed

EXCEPTION: Error in /data/data/org.nativescript.EatSafe/files/app/pages/login/login.html:5:75
ORIGINAL EXCEPTION: Error: not implemented
ORIGINAL STACKTRACE:
Error: not implemented
    at NativeScriptDomAdapter.Parse5DomAdapter.getCookie (/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/platform-server/src/parse5_adapter.js:619:68)
    at CookieXSRFStrategy.configureRequest (/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/http/src/backends/xhr_backend.js:150:82)
    at XHRBackend.createConnection (/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/http/src/backends/xhr_backend.js:165:28)
    at httpRequest (/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/http/src/http.js:22:20)
    at Http.post (/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/http/src/http.js:78:16)
    at UserService.signin (/data/data/org.nativescript.EatSafe/files/app/shared/services/user.service.js:13:27)
    at LoginComponent.login (/data/data/org.nativescript.EatSafe/files/app/pages/login/login.component.js:31:27)
    at DebugAppView._View_LoginComponent0._handle_tap_8_0 (LoginComponent.template.js:355:28)
    at /data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/linker/view.js:375:24
    at /data/data/org.nativescript.EatSafe/files/app/tns_modules/nativescript-angular/renderer.js:204:26
ERROR CONTEXT:
[object Object]
File: "/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/linker/view.js, line: 365, column: 16

StackTrace: 
    Frame: function:'DebugAppView._rethrowWithContext', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/linker/view.js', line: 365, column: 17
    Frame: function:'', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/linker/view.js', line: 378, column: 23
    Frame: function:'', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/nativescript-angular/renderer.js', line: 204, column: 26
    Frame: function:'ZoneDelegate.invoke', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/zone.js/dist/zone-node.js', line: 290, column: 29
    Frame: function:'NgZoneImpl.inner.inner.fork.onInvoke', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/zone/ng_zone_impl.js', line: 53, column: 41
    Frame: function:'ZoneDelegate.invoke', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/zone.js/dist/zone-node.js', line: 289, column: 35
    Frame: function:'Zone.run', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/zone.js/dist/zone-node.js', line: 183, column: 44
    Frame: function:'NgZoneImpl.runInner', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/zone/ng_zone_impl.js', line: 84, column: 71
    Frame: function:'NgZone.run', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/@angular/core/src/zone/ng_zone.js', line: 235, column: 66
    Frame: function:'zonedCallback', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/nativescript-angular/renderer.js', line: 203, column: 24
    Frame: function:'Observable.notify', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/data/observable/observable.js', line: 174, column: 23
    Frame: function:'Observable._emit', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/data/observable/observable.js', line: 193, column: 18
    Frame: function:'_android.setOnClickListener.android.view.View.OnClickListener.onClick', file:'/data/data/org.nativescript.EatSafe/files/app/tns_modules/ui/button/button.js', line: 33, column: 32


    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:862)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:727)
    at com.tns.Runtime.callJSMethod(Runtime.java:713)
    at com.tns.Runtime.callJSMethod(Runtime.java:694)
    at com.tns.Runtime.callJSMethod(Runtime.java:684)
    at com.tns.gen.android.view.View_OnClickListener.onClick(View_OnClickListener.java:11)
    at android.view.View.performClick(View.java:5233)
    at android.view.View$PerformClick.run(View.java:21209)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:152)
    at android.app.ActivityThread.main(ActivityThread.java:5507)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

アップデートのリリース ログをオンラインで調べて、重大な変更があるかどうかを確認しようとしましたが、役に立ちませんでした。新しいネイティブ スクリプトの角度更新を使用して http 呼び出しを行う方法についての指針はありますか?

ありがとうございました

4

2 に答える 2

2

app.moudle.ts以下にインポートすることでこれを修正しました

import {NativeScriptHttpModule} from 'nativescript-angular/http';

その後

 imports: [NativeScriptHttpModule]
于 2017-06-07T03:46:30.310 に答える