【发布时间】:2018-03-18 23:43:46
【问题描述】:
我正在接管一个 Cordova/Ionic 项目。我以前从未使用过 Cordova 或 Ionic,所以我在该领域完全是初学者。不过,我已经使用 Node 工作了几年,断断续续地工作了几年,所以我基本了解这一点。
我提出了一个问题并实施了解决方案:
How to register code with the deviceready event in a Cordova / Ionic project?
这给我留下了这个问题:
Ionic2, how to import custom plugin (appsee or uxcam) into Ionic App
我不清楚该页面上的答案是什么意思。
现在,在这个文件中:
src/app/app.component.ts
我现在有这个导入语句:
import { Component, ViewChild } from '@angular/core';
import { Platform, Nav, App } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Storage } from '@ionic/storage';
import { LoginPage } from '../pages/login/login';
import { TabsPage } from "../pages/tabs/tabs";
import { ProfilePersonThingsPage } from "../pages/profile-person-things/profile-person-things";
import { CreateProfileBasicsPage } from '../pages/create-profile-basics/create-profile-basics';
import { Keyboard } from '@ionic-native/keyboard';
import { ProfileOwnerEditPage } from '../pages/profile-owner-edit/profile-owner-edit';
import { AlertScreen } from '../providers/services/alertScreen.service';
import { ApiProvider } from '../providers/api/api';
import { SUCCESS_STATUS, ERROR_STATUS, ACCESS_DENIED, TypeTabIndex , TypePush} from '../constants/config';
import { LoadingScreenProvider } from '../providers/services/loadingScreen.service';
import { ProfileOwnerSettingsPage } from '../pages/profile-owner-settings/profile-owner-settings';
import { ProfileOwnerSupportPage } from '../pages/profile-owner-support/profile-owner-support';
import { Events } from 'ionic-angular';
import { ProfilePersonPage } from '../pages/profile-person/profile-person';
import { SocketProvider } from '../providers/services/socket.service';
import { ShareProvider } from '../providers/services/share.service';
import { PushNotificationComponent } from "../components/push-notification/push-notification";
import { ConversationPage } from './../pages/conversation/conversation';
import { PushNotificationProvider } from './../providers/services/pushnotification.service';
import { Appsee } from 'cordova-plugin-appsee';
但如果我跑:
ionic serve
最后一行抛出错误:
typescript: src/app/app.component.ts, line: 26
Cannot find module 'cordova-plugin-appsee'.
如果我看这里:
https://www.appsee.com/docs/ios/ionic
文档表明这就是我所要做的:
ionic cordova plugin add cordova-plugin-appsee
我已经做到了。
如果我这样做:
find . -name "*appsee*"
我看到了:
./plugins/cordova-plugin-appsee
./plugins/cordova-plugin-appsee/src/android/appsee.jar
如果我删除这一行:
import { Appsee } from 'cordova-plugin-appsee';
然后我运行ionic serve 然后应用程序启动时没有错误,但是当我尝试加载页面时,我得到:
Uncaught (in promise): ReferenceError: Appsee is not defined ReferenceError: Appsee is not defined at http://localhost:8100/build/main.js:6422:13 at t.invoke (http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke (http://localhost:8100/build/vendor.js:4509:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:9223) at r.run (http://localhost:8100/build/polyfills.js:3:4452) at http://localhost:8100/build/polyfills.js:3:14076 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967) at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4500:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888) at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
我需要做什么才能完成这项工作?
另外,在我链接到的前面的问题中,有人将其放在评论中:
You need to test this on device or emulator. – Sampath Dec 5 '17 at 2:47
这是什么意思?
【问题讨论】:
-
你有没有解决这个问题?我也有同样的问题。