Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Not compatible with cordova-ios 6 #624

Closed
dpogue opened this issue Jun 3, 2020 · 49 comments
Closed

Not compatible with cordova-ios 6 #624

dpogue opened this issue Jun 3, 2020 · 49 comments

Comments

@dpogue
Copy link
Contributor

dpogue commented Jun 3, 2020

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
@davidellolio
Copy link

Hi,

I have the same error.

D.

@juanlurie
Copy link

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

@sectionDayongtek
Copy link

Hi, I have the same problem.

help plz...

@juanlurie
Copy link

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.

@jacobg
Copy link

jacobg commented Jun 24, 2020

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.

@swbradsh
Copy link

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

@bobrosoft
Copy link

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

@phyr0s
Copy link
Contributor

phyr0s commented Jul 14, 2020

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.

@NickChowDev
Copy link

NickChowDev commented Jul 17, 2020

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 apache/cordova-ios#773 ?

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

@bobrosoft
Copy link

bobrosoft commented Jul 17, 2020

@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" />

@phyr0s
Copy link
Contributor

phyr0s commented Jul 17, 2020

@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" />

@NickChowDev
Copy link

NickChowDev commented Jul 17, 2020

@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]

@bobrosoft
Copy link

bobrosoft commented Jul 17, 2020

@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
Copy link

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

@swbradsh
Copy link

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

@bobrosoft
Copy link

bobrosoft commented Jul 17, 2020

@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.

@ermik
Copy link
Contributor

ermik commented Jul 19, 2020

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 #513 (comment)

@phyr0s
Copy link
Contributor

phyr0s commented Jul 22, 2020

@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.

@ermik
Copy link
Contributor

ermik commented Jul 22, 2020

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.

@phyr0s
Copy link
Contributor

phyr0s commented Jul 24, 2020

@ermik 👍

@alexandergoncharov-zz
Copy link
Contributor

Hi all,

We merged #513 and publish a new version: https://github.com/microsoft/cordova-plugin-code-push/releases/tag/v1.13.0

It should fix supporting cordova-ios@6. Could you please test it and let me know your results?

@NickChowDev
Copy link

NickChowDev commented Jul 28, 2020

Hi all,

We merged #513 and publish a new version: https://github.com/microsoft/cordova-plugin-code-push/releases/tag/v1.13.0

It should fix supporting cordova-ios@6
Could you please test it and let me know your results?

image
The app still showed a blank screen after a new update installation

here is the package:
"dependencies": {
"code-push": "3.0.1",
"cordova": "9.0.0",
"cordova-ios": "^6.1.0",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-advanced-http": "3.0.0",
"cordova-plugin-app-preferences": "^0.99.3",
"cordova-plugin-buildinfo": "4.0.0",
"cordova-plugin-code-push": "1.13.0",
"cordova-plugin-exclude-files": "^1.0.1",
"cordova-plugin-file": "6.0.2",
"cordova-plugin-keyboard": "^1.2.0",
"cordova-plugin-media": "5.0.3",
"cordova-plugin-qrscanner": "^3.0.1",
"cordova-plugin-screen-orientation": "3.0.2",
"cordova-plugin-settings-hook": "^0.3.1",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-zip": "3.1.0",
"cordova-sqlite-storage": "5.0.1"
}

I am no idea how to file the problem.....no error message in the console:

codePushSyncStatus 7
[CodePush] Downloading update
[CodePush] Package download success: {"deploymentKey":"xxx","label":"v1","appVersion":"1.0.0","isMandatory":false,"packageHash":"xxx","isFirstRun":false,"failedInstall":false,"localPath":"cdvfile://localhost/library-nosync/codepush/download/update.zip"}
codePushSyncStatus 8
[CodePush] Installing update
[CodePush] Applying full update
[CodePush] Install succeeded.
codePushSyncStatus 1

Main Thread Checker: UI API called on a background thread: -[WKWebView loadRequest:]
PID: 3311, TID: 1439918, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
[CDVWebViewEngine loadRequest:] + 2080
[CodePush loadURL:] + 156
[CodePush loadPackage:] + 120
__20-[CodePush install:]_block_invoke + 652
libdispatch.dylib _dispatch_call_block_and_release + 24
libdispatch.dylib _dispatch_client_callout + 16
libdispatch.dylib _dispatch_queue_override_invoke + 872
ibdispatch.dylib _dispatch_root_queue_drain + 376
libdispatch.dylib _dispatch_worker_thread2 + 152
libsystem_pthread.dylib _pthread_wqthread + 212
libsystem_pthread.dylib start_wqthread + 8

[reports] Main Thread Checker: UI API called on a background thread: -[WKWebView loadRequest:]
PID: 3311, TID: 1439918, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
-[CDVWebViewEngine loadRequest:] + 2080
-[CodePush loadURL:] + 156
-[CodePush loadPackage:] + 120
__20-[CodePush install:]_block_invoke + 652
libdispatch.dylib _dispatch_call_block_and_release + 24
libdispatch.dylib _dispatch_client_callout + 16
libdispatch.dylib _dispatch_queue_override_invoke + 872
libdispatch.dylib _dispatch_root_queue_drain + 376
libdispatch.dylib _dispatch_worker_thread2 + 152
libsystem_pthread.dylib _pthread_wqthread + 212
libsystem_pthread.dylib start_wqthread + 8

tcp_input [C4.1:3] flags=[R] seq=846688115, ack=0, win=0 state=LAST_ACK rcv_nxt=846688115, snd_una=2978486252
tcp_input [C4.1:3] flags=[R] seq=846688115, ack=0, win=0 state=CLOSED rcv_nxt=846688115, snd_una=2978486252
tcp_input [C4.1:3] flags=[R] seq=846688115, ack=0, win=0 state=CLOSED rcv_nxt=846688115, snd_una=2978486252
tcp_input [C5.1:3] flags=[R] seq=267997014, ack=0, win=0 state=CLOSE_WAIT rcv_nxt=267997014, snd_una=3094212520
tcp_input [C6.1:3] flags=[R] seq=3760256249, ack=0, win=0 state=LAST_ACK rcv_nxt=3760256249, snd_una=1398964983
tcp_input [C6.1:3] flags=[R] seq=3760256249, ack=0, win=0 state=CLOSED rcv_nxt=3760256249, snd_una=1398964983
tcp_input [C6.1:3] flags=[R] seq=3760256249, ack=0, win=0 state=CLOSED rcv_nxt=3760256249, snd_una=1398964983

@szh
Copy link

szh commented Jul 28, 2020

Thanks guys for pushing a new version!
I'm unfortunately still having the same results as @NickChowHK

Edit: Let's continue discussing this issue in #611

@phyr0s
Copy link
Contributor

phyr0s commented Jul 31, 2020

@alexandergoncharov I tried to archive running cordova build ios --device but fails.

@daisito
Copy link

daisito commented Aug 29, 2020

With cordova-ios 5.1.1 resolved me problem

@pitAlex
Copy link

pitAlex commented Aug 29, 2020

With cordova-ios 5.1.1 resolved me problem

You cannot use less than cordova ios 6. Apple will reject any new package still referencing UIWebView.

@daisito
Copy link

daisito commented Aug 29, 2020

With cordova-ios 5.1.1 resolved me problem

You cannot use less than cordova ios 6. Apple will reject any new package still referencing UIWebView.

But Cordova iOS 6 is problem with code push of appcenter!!
Any solutions?

@pitAlex
Copy link

pitAlex commented Aug 29, 2020

Most are in the same position. Because of Apple requirements, there really isn't anything to do but either wait for the owners of this plugin to make the updates or do them yourself. In our case, the plugin works as we only use the code-push cli, version 2.1.9.

@alexandergoncharov-zz
Copy link
Contributor

Hi all,

If you still have issues could you please provide some demo app with reproducing issue and reprosteps?
Unfortunately, we can't reproduce any issues with it.

@sithwarrior
Copy link

Hi @alexandergoncharov Im experiencing the same issue with this version.

App updates using codepush results in a white page.
Debugging using Safari, shows that the index.html of the new package returns a 404

URL: app://localhost/Users/psykes/Library/Developer/CoreSimulator/Devices/635EC000-85A2-4174-B410-C87EDB6D18FA/data/Containers/Data/Application/3B86386E-DF1C-4855-BC9F-CC8C0729E186/Library/NoCloud/codepush/deploy/versions/b8affdc4e310826555cb3300e112d53caa8bef1db87c2bc53c4ba7fcf217e9ff/www/index.html Status: 404 Source: —

It could seem like this plugin doesnt handle the new Url Scheme of Cordova IOS 6+ app://localhost ?

UIWebView
Additionally, the plugin still contains code referencing UIWebView
[(UIWebView*)self.webView loadRequest:[NSURLRequest requestWithURL:url]];

This would prevent any new app built with this plugin to be submitted to the App Store, and any app update with this plugin, would get a warning, and not be possible by December. Info from Apple https://developer.apple.com/news/?id=12232019b

@sithwarrior
Copy link

@alexandergoncharov I just tested using the included Sample Apps in this project https://github.com/microsoft/cordova-plugin-code-push/tree/master/samples

If you use the new recommended Url Scheme of Cordova iOS 6
<preference name="scheme" value="app" /> <preference name="hostname" value="localhost" />

This results in a 401, after an app update.

The new Url Scheme is recommended to avoid CORS restrictions, hosting your ios app from file://
https://cordova.apache.org/announcements/2020/06/01/cordova-ios-release-6.0.0.html

Additionaly, WKURLSchemeHandler support has been introduced with this release. Using a custom scheme to serve your app content through fixes CORS issues that exist because of the strict security policies that WKWebView has applied to the file scheme. You can easily configure your Cordova project to use a custom scheme by setting the preference options scheme and hostname in the config.xml file.

@pitAlex
Copy link

pitAlex commented Sep 7, 2020

[(UIWebView*)self.webView loadRequest:[NSURLRequest requestWithURL:url]];

I can confirm it does show warning upon uploading to iTunes. You can't check if the class exists and you can't have it like that either. There must be no "UIWebView" mentioned in code. I personally removed the lines and did not see anything break yet.

@Krasavinigor
Copy link
Contributor

Hi @pitAlex!
We know that UIWebView is deprecated. We are going to remove all usage of UIWebView soon.

@mden-crf
Copy link

With 1.13.0 the download progress callback is no longer firing. This is for both Android and iOS.

Hello, does anybody has a workaround to have the download progress callback with 1.13.x? As @pitAlex mentionned before, it is no longer firing. Seems linked to #652 too.

@mark-divitt
Copy link

Hi Folks, where are we with this issue? iOS 14 is released that requires WKWebView. Sure seems to me like this would be a #1 priority to get fixed as CodePush for Cordova (on iOS) is completely broken as this point. Any activity on this?

@ruslan-bikkinin
Copy link
Contributor

Hi everyone and deeply sorry for such a delayed response. The team was highly underresourced and couldn't take care of this immediately.
Anyway, here's the PR for fixing this #655. We would appreciate any other 👀 from the community on it.

@ruslan-bikkinin
Copy link
Contributor

The new version that fixes the problems with WKWebView for cordova-ios@6 just has been released: v2.0.0. Also, in this version support for UIWebView is dropped as well.
I'm going to close this issue so if you have any other problems with cordova-ios 6 on 2.0.0 version of the plugin, please create another one.

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests