ios - ionic 框架ios构建失败社会共享|偏爱

标签 ios ionic-framework ionic4

尝试在Ionic Pro Service中构建iOS时遇到此问题。

这是输出:

[14:05:26]: ▸ > GlamitApp@0.0.1 build /builds/project-0
[14:05:26]: ▸ > ionic-app-scripts build --buildConfig=build.json
[14:05:28]: ▸ [14:05:28]  ionic-app-scripts 3.1.2 
[14:05:28]: ▸ [14:05:28]  build dev started ...
[14:05:28]: ▸ [14:05:28]  clean started ...
[14:05:28]: ▸ [14:05:28]  clean finished in 4 ms
[14:05:28]: ▸ [14:05:28]  copy started ...
[14:05:28]: ▸ [14:05:28]  deeplinks started ...
[14:05:28]: ▸ [14:05:28]  deeplinks finished in 229 ms
[14:05:28]: ▸ [14:05:28]  transpile started ...
[14:05:33]: ▸ [14:05:33]  typescript: src/app/app.component.ts, line: 51 
[14:05:33]: ▸ Cannot find name 'SocialSharing'.
[14:05:33]: ▸       L50:    public events: Events,
[14:05:33]: ▸       L51:    private socialSharing: SocialSharing
[14:05:33]: ▸       L52:  ) {
[14:05:33]: ▸ [14:05:33]  typescript: src/app/app.module.ts, line: 64 
[14:05:33]: ▸ Argument of type '{ declarations: (typeof ChatPage | typeof RatePage | typeof DetallePedidoPage | typeof
[14:05:33]: ▸ HistorialP...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are
[14:05:33]: ▸ incompatible. Type '(typeof SplashScreen | SocialSharingOriginal | typeof UserProvider | typeof InAppBrowser
[14:05:33]: ▸ | AppVer...' is not assignable to type 'Provider[]'. Type 'typeof SplashScreen | SocialSharingOriginal |
[14:05:33]: ▸ typeof UserProvider | typeof InAppBrowser | AppVers...' is not assignable to type 'Provider'. Type
[14:05:33]: ▸ 'SocialSharingOriginal' is not assignable to type 'Provider'. Type 'SocialSharingOriginal' is not assignable
[14:05:33]: ▸ to type 'ClassProvider'. Property 'provide' is missing in type 'SocialSharingOriginal'.
[14:05:33]: ▸       L64:  @NgModule({                                                                                                                                                
[14:05:33]: ▸       L65:    declarations: [
[14:05:33]: ▸ [14:05:33]  typescript: src/pages/login/login.ts, line: 41 
[14:05:33]: ▸ Cannot find name 'AppVersion'.
[14:05:33]: ▸       L40:  public events: Events,
[14:05:33]: ▸       L41:  private appVersion: AppVersion) {
[14:05:33]: ▸       L42:  localStorage.removeItem('access_token');
[14:05:33]: ▸ [14:05:33]  typescript: src/pages/my-profile/my-profile.ts, line: 30 
[14:05:33]: ▸ Cannot find name 'AppVersion'.
[14:05:33]: ▸       L29:  public platform: Platform,
[14:05:33]: ▸       L30:  private appVersion: AppVersion) {
[14:05:33]: ▸ [14:05:33]  ionic-app-script task: "build" 
[14:05:33]: ▸ [14:05:33]  Error: Failed to transpile program 
[14:05:33]: ▸ Error: Failed to transpile program
[14:05:33]: ▸     at new BuildError (/builds/project-0/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
[14:05:33]: ▸     at /builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
[14:05:33]: ▸     at new Promise ()
[14:05:33]: ▸     at transpileWorker (/builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
[14:05:33]: ▸     at Object.transpile (/builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
[14:05:33]: ▸     at /builds/project-0/node_modules/@ionic/app-scripts/dist/build.js:109:82
[14:05:33]: ▸     at 
[14:05:33]: ▸ npm ERR! code ELIFECYCLE
[14:05:33]: ▸ npm ERR! errno 1
[14:05:33]: ▸ npm ERR! GlamitApp@0.0.1 build: `ionic-app-scripts build --buildConfig=build.json`
[14:05:33]: ▸ npm ERR! Exit status 1
[14:05:33]: ▸ npm ERR!
[14:05:33]: ▸ npm ERR! Failed at the GlamitApp@0.0.1 build script.
[14:05:33]: ▸ npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

在项目中正确添加了SocialSharing和AppVersion,
总是编译并确定,但是现在我有此错误。

问题是该组件还是另一件事?

有人可以帮助我吗?我需要解决这个问题。
谢谢!

最佳答案

我也面临着社交共享插件的循环依赖问题。我已经有一段时间没有使用插件了,看来@ionic-native/social-sharing包现在导出了SocialSharingOriginal类,而不是通常的SocialSharing。到目前为止,还没有发现任何更改日志来突出显示重大更改,这可能是Ionic 4

到目前为止,一种解决方法是导入SocialSharing类,如下所示。

import { SocialSharing} from '@ionic-native/social-sharing/ngx';

并且不要忘记将constructor声明和app.module.ts导入还原为SocialSharing

关于ios - ionic 框架ios构建失败社会共享|偏爱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54404724/

相关文章:

ios - 为什么 locationManager didUpdateLocation 不工作?

angular - ionic 4 native http 获取空数组

ios - 未收到 Twilio 聊天推送通知(Ionic 和 Firebase)

objective-c - Objective-C 中初始化对象的不同方式

ios - 应用程序进入后台时如何播放通知声音?

javascript - 使用后退按钮时的 $broadcast 和 $on 问题

ios - iOS 构建失败,线程 1 : signal SIGABRT on iOS 12. 4

android - Cordova 编译 android 不同于 ios

javascript - Ionic(单击)在 AlertController 消息属性中不起作用

ios - UITableViewCell 中的标记