gpt4 book ai didi

angular - 添加 SMS 插件 Ionic 时,Type Error Object 不是函数

转载 作者:行者123 更新时间:2023-12-04 12:44:14 25 4
gpt4 key购买 nike

尝试使用

cordova-sms-plugin



在应用程序中添加短信功能。
我已经完成了文档中提到的安装 ->
https://ionicframework.com/docs/native/sms/

我添加行
import { SMS } from '@ionic-native/sms';

但是当我添加
public sms: SMS

在构造函数参数中,它在 JS 控制台中引发以下错误并且页面停止工作。

core.js:12501 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function TypeError: Object(...) is not a function at index.js:93 at Module../node_modules/@ionic-native/sms/index.js (index.js:142) at webpack_require (bootstrap:83) at Module../src/app/pages/sendtext/sendtext.page.ts (pages-sendtext-sendtext-module.js:92) at webpack_require (bootstrap:83) at Module../src/app/pages/sendtext/sendtext.module.ts (pages-sendtext-sendtext-module.js:18) at webpack_require (bootstrap:83) at $_lazy_route_resource lazy namespace object:32 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:14060) at resolvePromise (zone.js:814) at resolvePromise (zone.js:771) at zone.js:873 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:14051) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595)



这只是一个基本的 ionic 安装,添加的唯一插件是 SMS 插件。
任何帮助表示赞赏。

下面是我在 package.json 文件中的依赖项部分。

"dependencies": { "@angular/common": "~7.0.0", "@angular/core": "~7.0.0", "@angular/forms": "~7.0.0", "@angular/http": "~7.0.0", "@angular/platform-browser": "~7.0.0", "@angular/platform-browser-dynamic": "~7.0.0", "@angular/router": "~7.0.0", "@ionic-native/core": "5.0.0-beta.21", "@ionic-native/sms": "^4.18.0", "@ionic-native/splash-screen": "5.0.0-beta.21", "@ionic-native/status-bar": "5.0.0-beta.21", "@ionic/angular": "4.0.0-beta.16", "cordova-android": "7.1.4", "cordova-ios": "4.5.5", "cordova-plugin-device": "^2.0.2", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^2.2.5", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "^1.3.3", "cordova-sms-plugin": "0.1.13", "core-js": "^2.5.4", "rxjs": "~6.3.3", "zone.js": "~0.8.26" },

最佳答案

添加模块类似...

import { SMS} from '@ionic-native/sms';
@NgModule({
providers: [
SMS
]
})

关于angular - 添加 SMS 插件 Ionic 时,Type Error Object 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53625774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com