cordova-plugin-code-push icon indicating copy to clipboard operation
cordova-plugin-code-push copied to clipboard

Not compatible with cordova-ios 6

Open dpogue opened this issue 6 years ago • 49 comments

Description

The cordova-plugin-code-push plugin depends on the deprecated (since 2017) cordova-plugin-file-transfer plugin, which is not compatible with cordova-ios 6 and results in compiler issues.

The ideal solution here would be for cordova-plugin-code-push to handle the downloading, unzipping, and installation of app bundles in native code, that same way that react-native-code-push does.

Reproduction

Install cordova-plugin-code-push in an app built with cordova-ios 6. There are compiler errors in the cordova-plugin-file-transfer Objective C files.

Additional Information

  • cordova-plugin-code-push version: 1.12.4
  • List of installed plugins: cordova-plugin-code-push
  • Cordova version: CLI 9.0.0 with [email protected]
  • iOS/Android/Windows version: iOS 13.5
  • Does this reproduce on a debug build or release build? Both
  • Does this reproduce on a simulator, or only on a physical device? Both

dpogue avatar Jun 03 '20 17:06 dpogue

Hi,

I have the same error.

D.

davidellolio avatar Jun 18 '20 23:06 davidellolio

I’m having the same problem. Juggling plugin versions for IOS with the WebKit restriction has led me to remove the cordova-plugin-file-transfer but that breaks code push

juanlurie avatar Jun 20 '20 06:06 juanlurie

Hi, I have the same problem.

help plz...

sectionDayongtek avatar Jun 22 '20 03:06 sectionDayongtek

I downgraded cordova-ios to 5.1.1 and added file transfer back and everything seems to be working now. The eco system is so fragile.

juanlurie avatar Jun 22 '20 06:06 juanlurie

Related to these issues #485 and #341. There's already a pull request #513 to remove file transfer, but Microsoft has neglected to merge it.

jacobg avatar Jun 24 '20 15:06 jacobg

cordova-ios 6 also removed CDVUserAgentUtil, which this plugin is still referencing.

swbradsh avatar Jun 26 '20 15:06 swbradsh

Use of undeclared identifier 'CDVUserAgentUtil' Switched to cordova-ios 5.1.1 because of that issue 🤦 https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/561

bobrosoft avatar Jul 03 '20 15:07 bobrosoft

cordova-ios 6 is a major update those changes are a requirement by Apple. In order to remain compliant in their ecosystem. UIWebView is not allowed anymore. It's important to update this plugin.

phyr0s avatar Jul 14 '20 08:07 phyr0s

Use of undeclared identifier 'CDVUserAgentUtil' Switched to cordova-ios 5.1.1 because of that issue 🤦 ionic-team/cordova-plugin-ionic-webview#561

@bobrosoft The cordova-ios 5.1.1 works well with code-push 1.12.0, but it will trigger the following issue if submitted to app store. May I know how you remove the UIWeivew from cordova-ios 5.1.1? Refer to this https://github.com/apache/cordova-ios/pull/773 ?

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.

NickChowDev avatar Jul 17 '20 08:07 NickChowDev

@NickChowHK yes, solved by using:

  • "cordova-ios": "^5.1.1",
  • "cordova-plugin-code-push": "^1.12.5",
  • "cordova-plugin-ionic-webview": "^5.0.0",

and adding next to <platform name="ios"> section of the config.xml:

        <preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

bobrosoft avatar Jul 17 '20 08:07 bobrosoft

@barryvdh yes with cordova-ios <6 this plugin works. The problem is that the apple ecosystem has changed and you will not be able to publish in the App Store with this plugin soon unless it is updated and guarantees compatibility with cordova-ios 6+.

With cordova-plugin-ionic-webview 5+ --> I think that you don't need this lines because only the WK engine is available now

<preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

phyr0s avatar Jul 17 '20 08:07 phyr0s

@NickChowHK yes, solved by using:

  • "cordova-ios": "5.1.1",
  • "cordova-plugin-code-push": "1.12.0",
  • "cordova-plugin-ionic-webview": "5.0.0",

and adding next to <platform name="ios"> section of the config.xml:

        <preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

@bobrosoft That's what I tried before..... however, it still triggers the ITMS-90809: Deprecated API Usage when I submit a new app yesterday.

Apple rejected the app even the app is running on WKWebview as the UIWebview Code exists in the [email protected] and [email protected]

NickChowDev avatar Jul 17 '20 08:07 NickChowDev

@NickChowHK clean everything, delete plugins folder, node_modules etc, everything temporary, platforms folder, rm -rf ~/Library/Developer/Xcode/DerivedData etc, ensure correct plugin version installed, check installed versions manually, set <plugin name="cordova-plugin-ionic-webview" spec="^5.0.0" /> in config.xml just in case (but I don't think it matters). I was able to push app without that warning, so, solved for me.

bobrosoft avatar Jul 17 '20 09:07 bobrosoft

@NickChowHK other solution will be to drop code-push and use latest cordova-ios.

bobrosoft avatar Jul 17 '20 09:07 bobrosoft

@NickChowHK You need to be on at least version 1.12.1 of this plugin to fix the WKWebView issue.

swbradsh avatar Jul 17 '20 13:07 swbradsh

@NickChowHK yes, I double-checked now, I actually have cordova-plugin-code-push version 1.12.5 installed, not 1.12.0. Sorry for misinform. What I don't understand now is from where it gets that 1.12.5 because in node_modules I see 1.12.0 installed definitely and I thought it is getting code from there, but looks as it resolves deps separately.

bobrosoft avatar Jul 17 '20 14:07 bobrosoft

Working iOS and Android with defaults platform versions.

Ionic:

   Ionic CLI                     : 6.10.1 (/Users/ludufre/.npm-packages/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.3
   @angular-devkit/build-angular : 0.901.11
   @angular-devkit/schematics    : 9.1.11
   @angular/cli                  : 9.1.11
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 9 other plugins)

Utility:

   cordova-res : 0.15.1
   native-run  : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/Users/ludufre/Library/Android/sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.2
   NodeJS            : v12.18.1 (/usr/local/bin/node)
   npm               : 6.14.5
   OS                : macOS
   Xcode             : Xcode 11.6 Build version 11E708

With [email protected] get error with deprecated CDVUserAgentUtil:

image

I didn't find any code that [CDVUserAgentUtil ...acquireLock] so I commented that line and compiled and worked perfectly in 6.1.1.

I made that small change, here it is: https://github.com/ludufre/cordova-plugin-code-push/commit/159e18cfa9e2aa0c5c6d47ca7b3f0e1d2b1c9f1e (I new on this Github thing, so I don't know how to send this change to this Pull Request / Or @ermik can do this change himself)

Originally posted by @ludufre in https://github.com/microsoft/cordova-plugin-code-push/pull/513#issuecomment-660669212

ermik avatar Jul 19 '20 23:07 ermik

@ermik is not a valid solution, cordova file transfer plugin is deprecated and must be removed in this plugin. In resume is not valid if you want to upload to market.

phyr0s avatar Jul 22 '20 12:07 phyr0s

Originally posted by @ludufre in #513 (comment)

@videmort As you can see at the bottom of my comment, I'm just reposting the relevant information which was provided by @ludufre in #513, so that it does not get unnoticed.

ermik avatar Jul 22 '20 15:07 ermik

@ermik 👍

phyr0s avatar Jul 24 '20 09:07 phyr0s