我忙于一个非常基本的Angular2 / Nativescript应用程序 . 我使用RestService与本地API通信,似乎有一些不一致的结果 . Web应用程序也使用此Rest Service,没有任何问题 . 当我调用ping(ip:string)函数来测试本地服务器的IP地址时,我得到一个错误,当我在console.log时它输出的错误是:

JS:TypeError:error.json()不是函数

知道这意味着什么吗?有没有办法调试/看看使用Nativescript发生了什么?
我能想到的移动应用和webb应用之间的唯一区别是每个使用不同版本的Typescript,这与我的问题有什么关系吗?

The ping function that doesn't work on the mobile app:

ping(ip: string) : Observable<any> {
      let tempUrl: string = "http://" + ip + "/BRMServices/WebEnquiry/ping";      
      return this.http.get(tempUrl)
      .map((res: Response) => res.json())
      .catch((error: any) => Observable.throw(error.json().error || 'server error'));
  }  


 The following function works perfectly on the mobile and web apps:

 getProduct(barcode: string): Observable<ProductModel> {          
      return this.http.get('http://10.60.160.34/BRMServices/WebEnquiry/' + "/POSEnquiry/" + barcode)
      .map((res: Response) => res.json())
      .catch((error: any) => Observable.throw(error.json().error || 'Server error'));
  }

  The Nativescript app uses Typescript V2.0.2,
  The webb app uses Typescript V~2.0.3