Telerik-Verified-Plugins / WKWebView

DEPRECATED - this plugin served a purpose in the past, but there are better implementation now
833 stars 150 forks source link

Build fails with Error code 65 on cordova-ios 4.0.1 #209

Open klyonrad opened 8 years ago

klyonrad commented 8 years ago

not posting the full error output but this seems to be the important part

/Users/user/some_path/CordovaApp/platforms/ios/CordovaApp/Plugins/com.telerik.plugins.wkwebview/MyMainViewController.m:4:9: fatal error: 
'Cordova/CDVLocalStorage.h' file not found
#import <Cordova/CDVLocalStorage.h>
    ^
1 error generated.

Downgrading to cordova-ios 3.9.2 seems to have helped the issue

EddyVerbruggen commented 8 years ago

Yeah they made a whole bunch of 'internal' plugins (like CDVLocalStorage) 'private', so this plugin can no longer access that class. Should be able to work around it, but I'm wondering if cordova-ios-4 compatibility is needed since Cordova now (with the cordova-ios-4 release) has official support for WKWebView with their own plugin.

Would love to hear everybody's input on this matter.

mathiasmuller4sh commented 8 years ago

Hi, They do support WKWebView but there is stil the issue for ajax call from file:// So ionic or angular app are not able to work

EddyVerbruggen commented 8 years ago

Oh, that's not very useful then.. unless you use inline angular templates I guess. I'll try and make an effort. The hardest part is making it backward compatible with cordova-ios-3.

mathiasmuller4sh commented 8 years ago

Inline template is indeed a nice work around. Haven't tried it. I stopped my test when i saw this error: the Origin null is not allowed by Access-Control-Allow-Origin error on each template..

andreialecu commented 8 years ago

Cordova's WKWebView support is iOS9 only. This plugin supports iOS 8 as well.

EddyVerbruggen commented 8 years ago

You're best off sticking with cordova-ios-3 for now. cordova-ios has been significantly restructured and a lot of things this plugin needs are now private, so inaccessible.

EddyVerbruggen commented 8 years ago

For folks using cordova-ios4 and targeting iOS8 and iOS9 who want to use WKWebView today, there is also this plugin. I didn't test it, but it may be worth a shot.

klyonrad commented 8 years ago

Should be able to work around it, but I'm wondering if cordova-ios-4 compatibility is needed since Cordova now (with the cordova-ios-4 release) has official support for WKWebView with their own plugin.

I personally have also come acrosse the issue of indexedDB not being available with the official plugin.

there is also this plugin. I didn't test it, but it may be worth a shot.

I would assume that they'll drop support for this one in favor of the new plugin.

So I suggest at least pointing out the compatibility issue in the README of your plugin

EddyVerbruggen commented 8 years ago

Good point, added the warning near the top.

popaprozac commented 8 years ago

Downgrading to 3.9.2 helped. No errors while building. Testing with an Ionic 2 app. Great performance boost.

Thanks!

hussfelt commented 8 years ago

:+1: on 3.9.2! Thanks @zb0t

prabhu2003ece commented 8 years ago

Yup downgrading to 3.9.2 works :+1: . Looks like 4.0 Version has cordovaLib separates Cordova/CDVLocalStorage.h as private plugin which xcode not including them.

EddyVerbruggen commented 8 years ago

Exactly (grrr) and a few other issues as well.

nitzanwilnai commented 8 years ago

Any update on this?

ghost commented 8 years ago

The hardest part is making it backward compatible with cordova-ios-3.

Sounds like a breaking change. Would it be possible to only support cordova-ios-4 with any new versions?

popaprozac commented 8 years ago

Official plugin works with ios@4.

https://github.com/apache/cordova-plugins/blob/master/wkwebview-engine-localhost/README.md

For use with a project with android, platform specific content src is required. The above plugin with set a local host while a crosswalk android build requires the default index.html

ghost commented 8 years ago

@zb0t with ios8?

popaprozac commented 8 years ago

@alexkavon I have tested it with a physical device running 9.2 and simulator. Will try iOS 8 right now and report back

popaprozac commented 8 years ago

@alexkavon Works like a charm on 8.4 simulator!

jpike88 commented 8 years ago

Why on Earth are you trying to maintain iOS 8 support? The vast majority of iOS are already on iOS 9 (or can update to it) and it's holding this project back. If you literally cannot support Cordova iOS 4 because of a select few users who can't be bothered to update their devices then I think that's a poor decision.

I'm sticking with cordova-plugin-wkwebview-engine for now (although the crash recovery on your one looks cool) and have been using it for a few months. It works great and the code is simple. I seriously think you guys should consider ditching iOS 8 support and allowing this plugin to take advantage of Cordova iOS, WKWebView is still cutting edge so why can't this plugin be too?

jpike88 commented 8 years ago

Better yet, why not approach the Cordova guys and ask them to move their repo to Github (as it's currently just being mirrored there from a crappy apache git server) to facilitate some sort of merge, as this one's crash recovery sounds handy?

EddyVerbruggen commented 8 years ago

@zb0t Please also check a real device as AFAIK the simulator is able to load files from the file:// protocol. That's bitten me when testing WKWebView in the past.

popaprozac commented 8 years ago

@EddyVerbruggen Okay I will test on a physical device

helgetan commented 8 years ago

Any updates on this?

popaprozac commented 8 years ago

On a physical iOS 9 device it appears to work just fine. Looking for a device with iOS 8!

andreialecu commented 8 years ago

There are certain workarounds implemented in this plugin that cordova's doesn't have, and various critical issues in that one as well that are not present in this one due to the use of the local web server. For example this one is critical for my app and I can't swap to that one: https://issues.apache.org/jira/browse/CB-10237?jql=project%20%3D%20CB%20AND%20labels%20%3D%20wkwebview-known-issues

Would be great if there could be a way to update the plugin to work with new cordova versions.

andreialecu commented 8 years ago

By the way, another plugin I'm using has figured out how to be compatible with both cordova-ios 3 and 4. It involves reading the platforms/package.json file on build using a hook, and depending on the iOS version, changing some macros in its source.

See: https://github.com/nordnet/cordova-hot-code-push/blob/master/scripts/lib/iosBackwardsCapabilitySupport.js https://github.com/nordnet/cordova-hot-code-push/blob/master/scripts/afterPrepareHook.js

Unfortunately I don't have time to figure it out myself so I'm leaving it here for someone else.

jcesarmobile commented 8 years ago

For those complaining about the cordova plugin (https://github.com/apache/cordova-plugin-wkwebview-engine) and the issues that it has, those are apple bugs. The way to workaround the bugs is using a local webserver like this plugin does.

So, if you are using the cordova plugin, you just have to install this plugin too to add a webserver. https://github.com/apache/cordova-plugins/tree/master/wkwebview-engine-localhost

After installing both, it should work the same way this plugin works, and if you still see bugs, create new issues on http://issues.cordova.io/

BTW, the crosswalk plugin adds WKWebView support too, not sure if it works with cordova ios 4 though.

akofman commented 8 years ago

@EddyVerbruggen Thanks for your awesome job, I'm a fan !

screen shot 2016-03-31 at 17 19 32

Concerning this plugin I think the official WKWebView is still young and needs time. So far it didn't consider settings configuration (I did a PR in order to fixe that point). Also I'm just encountering some issues with the localstorage, and the scroll behaviour looks different. That's what I can see from my side but I guess other developers could find other regressions.

As @jcesarmobile said, using wkwebview-engine-localhost should help but I don't think it's enough at the moment (from my point of view). And yes it's a very good idea to create issues in order to improve it :+1:

Why I'm rekindling this thread is just because a lot of projects can't be migrated to the official plugin because of regression issues and are just stuck with cordova-ios@3.9.2. I think it would be better to encourage people to migrate to the latest cordova-ios version and wait for some fixes on the official WKWebView plugin before using it (and it could take time).

So to conclude, that will be awesome if you could fix this issue 😄 But if you don't have time to do it, I could understand and I'll try to do something.

andreialecu commented 8 years ago

I gave the official wkwebview plugin a try and it has so many issues (that are resolved in this one) that it is unusable.

For example, it is impossible to use cdvfile:// urls without the local webserver engine plugin, and even then, I could not get CDVFileTransfer to work properly, getting various permission errors while trying to save files. I think it tries to be smart and override urls automatically but something doesn't work somewhere along the way and breaks a lot of things.

From my experience attempting this migration, my conclusion is that there are so many problems with the official plugin that it is definitely not usable for any moderately complex app at this point - and I'm not seeing any signs that they're actively maintaining it. There are barely any people using it from what I can see, because there is a severe lack of discussion regarding most of these issues.

That said, however, I think it might be easier to fork the official plugin and add the functionality included in this plugin (specifically the local file system proxy via http://localhost:12344/Library/, /Documents/, etc), the auto-restart functionality, and the various other tweaks that evolved here.

jsbranco commented 8 years ago

@andreialecu, @klyonrad I recently faced the same issue where the CDVLocalStorage file was failing the build. I didn't want to downgrade to an older version of cordova so I tried the official wekwebview but ended up with troubles using the FILE_URI from Cordova Camera to Cordova File Transfer. What I did was to actually use the cdvfille:// with the temp folder val localPath ="cdvfile://"+imageData.substring(imageData.lastIndexOf("/Users/"),imageData.length)

(imageData, comes from the Cordova Camera)

This did the trick for me actually.

I also agree if we could have the features of this library added to the Official plugin it would be really great as the official does lack of essential features

Ramblurr commented 8 years ago

Just starting to use this plugin in an existing project. I was already on ios 4.x. Is there any update regarding 4.x support?

barocsi commented 8 years ago

@branco91 can you please elaborate? Is your solution for Teleriks or the official WKWebview? Is it to work with images selected from gallery? Right now every taken picture returns a fileURL not the direct imagedata. https://github.com/apache/cordova-plugin-camera#module_camera.getPicture suggests using FILE_URI instead of DATA_URL because of crashes.

NOTE: Photo resolution on newer devices is quite good. Photos selected from the device's gallery are not downscaled to a lower quality, even if a quality parameter is specified. To avoid common memory problems, set Camera.destinationType to FILE_URI rather than DATA_URL.

barocsi commented 8 years ago

Is this a sort of 22 catch. Accessing photos requires webserver. Requires this plugin, the other one does not work. However this one never compiles for cordova ios 4. But other plugins might require that so basically we re stuck on the 3.9.2. level. So how others solve this issue while keeping wkwebview support? Even need to discover whether this repo is even maintained.

EddyVerbruggen commented 8 years ago

Can you give examples of plugins requiring cordova-ios-4? That's not a requirement I like to impose on projects.

barocsi commented 8 years ago

I have just ran into https://github.com/phonegap/phonegap-plugin-push/releases requires ios 4 above 1.5.3, and is at 1.6.3 already with many essential fixes.

apparition47 commented 8 years ago

cordova-plugin-iosrtc (WebRTC for iOS) also requires Cordova iOS 4.

clauderic commented 8 years ago

For my app, the fix that this plugin provides for KeyboardDisplayRequiresUserAction is essential, so moving to the official cordova wkwebview plugin will never be an option unless they implement something of the sort, which I doubt will ever happen.

I also would like to use https://github.com/phonegap/phonegap-plugin-push/, but it requires cordova-ios-4

guyromb commented 8 years ago

Is there any milestone planed to fix this issue?

dbpieter commented 8 years ago

@clauderic We have exactly the same issue. You can fix KeyboardDisplayRequiresUserAction by implementing the same hacky fix that was implemented in the telerik wkwebview : https://github.com/Telerik-Verified-Plugins/WKWebView/commit/04e8296adeb61f289f9c698045c19b62d080c7e3

clauderic commented 8 years ago

Yeah, that's exactly what I ended up doing @dbpieter. Works like a charm.

Michael-Stanford commented 7 years ago

@EddyVerbruggen "Can you give examples of plugins requiring cordova-ios-4? That's not a requirement I like to impose on projects."

Installing "phonegap-plugin-push" for ios
Plugin doesn't support this project's cordova-ios version. cordova-ios: 3.9.2, failed version requirement: >=4.3.0
jcesarmobile commented 7 years ago

@Michael-Stanford, he said that 8 months ago, in the meantime Xcode 8 was released requiring .entitlement files for push notifications and cordova-ios 4.x.x dealt with them, so it's a requirement now

Michael-Stanford commented 7 years ago

@jcesarmobile Thanks for your quick response. The Readme at https://github.com/Telerik-Verified-Plugins/WKWebView says "At the moment this plugin is NOT compatible with Cordova-iOS-4 (so use 3.x), see #209 for details." Does this mean that this WKWebView is no longer supported?

JEGardner commented 7 years ago

The need for me to upgrade to cordova-ios 4 to work with XCode 8 has meant that I've unfortunately had to stop using this plugin on all our apps, which is a real shame as it's great. Had to revert to UIWebView for now as I couldn't get Cordova's version to work with the camera etc.

mxmzb commented 7 years ago

This is a kinda sad thread :( bye native transitions. Ionic doesn't cease to disappoint the more you dig into it (not flaming any of the contributor guys of this plugin or anything, just bit disappointed from the overall Ionic experience).

phyr0s commented 6 years ago

So.... this plugin will be deprecated forever?

PierBover commented 6 years ago

Ionic doesn't cease to disappoint the more you dig into it (not flaming any of the contributor guys of this plugin or anything, just bit disappointed from the overall Ionic experience).

This is a bug with WkWebView. You can blame Apple for nor fixing it: https://bugs.webkit.org/show_bug.cgi?id=154916

schumannd commented 6 years ago

So is this plugin abandoned then? Would be nice to read in the README

EddyVerbruggen commented 6 years ago

@schumannd See the comments at the top of the readme, and the issue it refers to. Since then Ionic created its own plugin, we're just keeping this one for older Cordova versions.