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

iOS: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.) #424

Closed
eskhool opened this issue Jul 2, 2018 · 37 comments
Closed

Comments

@eskhool
Copy link

eskhool commented Jul 2, 2018

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Description

Using version 1.11.11 of the plugin, if we do: codePush.sync() or basically anything that executes restartApplication()

Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.)
Happens in the latest ios under WKWebview engine.

The readme states

iOS (cordova-ios 3.9.0+) - Note: In order to use CodePush along with the cordova-plugin-wkwebview-engine plugin, you need to install v1.5.1-beta+ version of cordova-plugin-code-push, which includes full support for apps using either WebView.

Is this still true at 1.11.11 or just that the documentation is lagging behind?

In any case, I can also verify that this issue persists with the following versions:

Running on an actual device iPhone 5s
iOS 10.3.3
cordova - 8.0.0 (same with 7.1.0)
cordova-plugin-wkwebview-engine 1.1.2

debug build
not tried on simulator yet

@eskhool
Copy link
Author

eskhool commented Jul 7, 2018

@alexandergoncharov, you seem to be the first responder from MS :) any inputs on this one? I have seen the existing issue closed pending on feedback from the OP but I am experiencing it right now and can assist with fixing it.

@alexandergoncharov-zz
Copy link
Contributor

Hi @eskhool ,
Yeah, That's correct =)
Thanks for reporting and sorry for this long delay.

Unfortunately I can't check it right now but you request in queue and I'll check it a little bit later. Sorry for this long delay.

Thanks,
Alexander

@eskhool
Copy link
Author

eskhool commented Jul 10, 2018

Hi @alexandergoncharov, glad to know you're alive and kicking =)

@alexandergoncharov-zz
Copy link
Contributor

Hi @eskhool ,
Sorry for this long delay.

I tried to reproduce this issue but my attempts were unsuccessful. I used just default approach with updating app with CodePush.sync() method. Could you please provide more detailed reprosteps or test project with repro steps?

Thanks,
Alexander

@eskhool
Copy link
Author

eskhool commented Jul 14, 2018

@alexandergoncharov, are you using WKWebview?

@eskhool
Copy link
Author

eskhool commented Jul 17, 2018

@alexandergoncharov, can you confirm this? I used the same default approach with codepush.sync() only and haven't tried anything fancy yet

@alexandergoncharov-zz
Copy link
Contributor

@eskhool Sorry for delay. Yeah, it was my wrong. I reproduced issue.
Starting to investigate it.

@eskhool
Copy link
Author

eskhool commented Jul 20, 2018

@alexandergoncharov, any progress on whats up with the wkwebview engine? am surprised that this isn't a more visible issue, thought the UIwebview engine was declared dead by apple and wkwebview is way more performant and standards compliant

@alexandergoncharov-zz
Copy link
Contributor

Yeah, I think I found the reason of issue and found approximate fix. Investigating to implement it with good approach. I'll keep you up to date.

@eskhool
Copy link
Author

eskhool commented Jul 21, 2018

great, keep us posted

@eskhool
Copy link
Author

eskhool commented Jul 24, 2018

@alexandergoncharov, any updates on this?

@eskhool
Copy link
Author

eskhool commented Jul 25, 2018

@alexandergoncharov, not to be pushy :) but is there an ETA so we can plan/set expectations accordingly?

@alexandergoncharov-zz
Copy link
Contributor

Hi @eskhool,
Sorry for delay.

Yeah, I'm still working on it. I think that I'll finish on this week.
But if you need to make it working really fast I can suggest to hot workaround for you. Please let me know if you would like.

Also, quick question: Are you using Ionic or PhoneGap or clear Cordova?

Thanks,
Alexander

@eskhool
Copy link
Author

eskhool commented Jul 26, 2018

Plain Cordova...if you have a workaround ready, love to hear it, as well to understand the issue also ...will take a final call depending on what it is and if you are actually able to find time to turn it around by the end of week :-)

@eskhool
Copy link
Author

eskhool commented Jul 26, 2018

@alexandergoncharov, also if you can release by the weekend, we can time it with an upgrade for our users (minimal disruption etc)

@alexandergoncharov-zz
Copy link
Contributor

Hi @eskhool ,

For hot workaround you should do next steps:

  1. Clone this repo and checkout to Goncharov/Revert_removing_CDVWKWebView+CodePush.m (or just download this branch form here https://github.com/Microsoft/cordova-plugin-code-push/tree/Goncharov/Revert_removing_CDVWKWebView+CodePush.m )
  2. Add this plugin version to your app (cordova plugin add <pathToDownloadedRepoVersion>)

This changes should fix your issue. Could you please check it and let me know if it was helpful for you or you still have this issue?

About issue: There is some path issue with WKWebView and CodePush. We had CDVWKWebViewEngine+CodePush.m file for fixing it but there was issue with Ionic features as Ionic has modified WKWebView. At now I'm working on making our plugin work with Ionic and clear Cordova + WKWebView.

Thanks,
Alexander

@eskhool
Copy link
Author

eskhool commented Jul 27, 2018

Hi @alexandergoncharov, from your identification of your issue it seems pretty obvious that WKWebView has been forked by Ionic and Codepush presently only support Ionic's version. Sounds like either the plugin needs to exist in 2 different version for Ionic/Cordova or it needs to have a conditional code path for the 2 different installed plugins (Ionic/Cordova versions)

Of course, ideally Ionic should have had their changes incorporated into upstream but don't know the facts/politics of that decision.

@alexandergoncharov-zz
Copy link
Contributor

alexandergoncharov-zz commented Jul 27, 2018

Hi @eskhool
That's correct, For now I have draft fix with conditional approach.
But I have some issues with Ionic. Also found one more issue with loading local files.
I'm sorry but I will not finish until the end of the week unfortunately as it should be completely fixed and more tested. Sorry that I provided incorrect ETA for you. My wrong.

Could you pleas clarify have you tested workaround? Is it work for you?

@eskhool
Copy link
Author

eskhool commented Jul 31, 2018

@alexandergoncharov, this branch seems to work. Haven't done testing if the update is valid etc but the error is gone.

Since installing from the branch is not convenient, can you please close this only after the plugin has been released with a cordova compatible version?

@alexandergoncharov-zz
Copy link
Contributor

@eskhool , Sorry for delay.

Yeah, sure. I'll close it only after getting fix in release. And also I will be keep you in up to date.

@aiba
Copy link

aiba commented Oct 17, 2018

I'm hitting this with Cordova+wkwebview (not ionic) and codepush 1.11.13. Is that expected? It wasn't clear to me if this has been fixed in the latest release.

@alexandergoncharov-zz
Copy link
Contributor

Hi @aiba ,
Thanks for reporting!

Yeah, it is known issue. After fixing issue with Ionic we'll fix this issue.

@eskhool
Copy link
Author

eskhool commented Oct 18, 2018

I'm hitting this with Cordova+wkwebview (not ionic) and codepush 1.11.13. Is that expected? It wasn't clear to me if this has been fixed in the latest release.

@aiba, unfortunately at present the cordova version is not working in favor of the ionic working till an ionic compatible fix is found. till then the only solution I can recommend is to use the branch @alexandergoncharov has noted above. It seems to work for me. Its not ideal, I know but C'est la vie.

@aiba
Copy link

aiba commented Oct 18, 2018

Thanks for the info! I'm now using the workaround branch from above, but it's obviously not ideal to be stuck on the branch and not benefit from the latest updates.

@alexandergoncharov at one point above in this thread, you mentioned that you had a draft fix that took a conditional path based on whether we were on ionic or not. If it's not too much trouble, I think it would be awesome to get that fix merged in to master so that we're not blocked on ionic making changes (which could be a while).

@aiba
Copy link

aiba commented Oct 26, 2018

A slight workflow note to other peole who want to use the workaround git branch from above: if you clone the repo locally and reference it using cordova plugin add /path/to/..., then things may not work on other computers that haven't checked out the repo locally. (I just ran into this issue).

Cordova supports adding git branches directly, so it should be possible to do:

$ cordova plugin add 'https://github.com/Microsoft/cordova-plugin-code-push#Goncharov/Revert_removing_CDVWKWebView+CodePush.m'

@alexandergoncharov-zz
Copy link
Contributor

@aiba , Sorry for long delay. Missed it.

Yeah, You are right but for now we have similar issue with Ionic's WKWebView. At first we should fix that issue and then I'll continue work on this.

Thanks for good suggestion with adding plugin directly from github repo!

@aiba
Copy link

aiba commented Nov 16, 2018

@alexandergoncharov thanks for the update. Do you have a link to that ionic wkwebview issue so we can stay updated on its progress?

@alexandergoncharov-zz
Copy link
Contributor

Hi @aiba ,

Ionic WebView issue was resolved. Working on this issue. For now I faced issue with LiveReload of Ionic WebView after adding logic for fixing this issue. So, My work in progress.

@npostulart
Copy link

@alexandergoncharov Without putting more pressure on you, but is there any news about the fix and when it probably will be official released? I'm currently using the fix branch you provided but would like to get back to the "normal" version as soon as possible.

@alexandergoncharov-zz
Copy link
Contributor

alexandergoncharov-zz commented Dec 11, 2018

Hi @npostulart ,

Sorry for delay. I implemented draft fix and it works. At now I'm working on refactoring.

@alexandergoncharov-zz
Copy link
Contributor

Hi all,

I prepared PR fir this issue: #483
Could please someone test it and let me know testing results?

Thanks,
Alexander

@alexandergoncharov-zz
Copy link
Contributor

For testing this pr you can add cordova-plugin-code-push to your app with this command:
$ cordova plugin add 'https://github.com/Microsoft/cordova-plugin-code-push#Goncharov/fix_WKWebView_engine_issue'

@aiba
Copy link

aiba commented Dec 17, 2018

@alexandergoncharov thank you for this change!!!

I tested it with my app and it works great. I'm excited to get back on the main line codepush branch.

The only issue I encountered during testing was noticing a stacktrace in the logs with message "UI API called on a background thread". But I think this has always been happening for me with codepush, and it seems to be more of a warning than an error that causes any problems.

Main Thread Checker: UI API called on a background thread: -[WKWebView loadFileURL:allowingReadAccessToURL:]
PID: 83236, TID: 11069877, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   Supportive                          0x0000000108cb24a5 -[CDVWKWebViewEngine(CodePush) loadRequest:] + 1061
5   Supportive                          0x0000000108cb6e35 -[CodePush loadURL:] + 149
6   Supportive                          0x0000000108cb6d4e -[CodePush loadPackage:] + 110
7   Supportive                          0x0000000108cb4bb1 __20-[CodePush install:]_block_invoke + 561
8   libdispatch.dylib                   0x000000010d879595 _dispatch_call_block_and_release + 12
9   libdispatch.dylib                   0x000000010d87a602 _dispatch_client_callout + 8
10  libdispatch.dylib                   0x000000010d87d064 _dispatch_queue_override_invoke + 1028
11  libdispatch.dylib                   0x000000010d88b00a _dispatch_root_queue_drain + 351
12  libdispatch.dylib                   0x000000010d88b9af _dispatch_worker_thread2 + 130
13  libsystem_pthread.dylib             0x000000010dc6970e _pthread_wqthread + 619
14  libsystem_pthread.dylib             0x000000010dc69435 start_wqthread + 13

@alexandergoncharov-zz
Copy link
Contributor

Hi @aiba,
Thanks for testing this!

Yeah, you are right. This issue was all the time. It also should be fixed but I think this is separate issue and we should investigate it separately.

@alexandergoncharov-zz
Copy link
Contributor

Hi all,

#483 PR already in Master and in new Release: https://github.com/Microsoft/cordova-plugin-code-push/releases/tag/v1.11.16

So, I'm going to close this issue for now. But please feel free to reopen it if you have any questions or face this issue again.

Also, I'll continue keep https://github.com/Microsoft/cordova-plugin-code-push/tree/Goncharov/Revert_removing_CDVWKWebView+CodePush.m branch for users who can't update plugin soon.

Thanks,
Alexander

@aiba
Copy link

aiba commented Dec 18, 2018

@alexandergoncharov thank you so much for your work on this. My team is using 1.11.16 and seems to be working great. Very happy to be back on the latest release :-).

@alexandergoncharov-zz
Copy link
Contributor

@aiba, I was glad to help! Thanks for using CodePush :)

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

4 participants