Hello everyone! I am asking this question since UIWebView is being deprecated. I did read the following ionic article:
If I understand this article correctly, we have 2 options:
- wait for cordova ios 6 (currently on night builds)
- upgrade to capacitor (rather easy. I have been able to migrate a complex ionic 3 app to capacitor).
Here comes my question. By curiosity, I went through the native code generated by capacitor on an ionic4 + capacitor and saw the following code:
Note that we do have some custom plugins, but the article states that Capacitor will replace every reference to UIWebView.
That being said, I can still see some references to UIWebView. I was wondering if that was normal and if I can be sure that Apple won’t reject the app if I use ionic 3 + capacitor or ionic 4 + capacitor.
Also me and my fellows had in mind that maybe Apple Testflight would help us figuring out whether or not Apple would reject our app. Is that the case? Can testflight actually determine if we will get the warning?
Thank you a lot for your time, this is a huge concern for me.
I hope you have a great week
This article suggests that some plugins might just use UIWebView anyways.
I will run grep -r “UIWebView” in the capacitor + ionic 3 app and paste the output below:
./App/public/build/vendor.js: // for UIWebView
./App/public/build/vendor.js: // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
./App/public/build/vendor.js: var zFactor = (Object(__WEBPACK_IMPORTED_MODULE_1__platform_platform_utils__["e" /* isSafari */])(plt) || Object(__WEBPACK_IMPORTED_MODULE_1__platform_platform_utils__["d" /* isIosUIWebView */])(plt)) ? (-s._renderedSize / 2) : 0;
./App/public/build/vendor.js: * WKWebView does not have this issue, only UIWebView does.
./App/public/build/vendor.js:/* harmony export (immutable) */ __webpack_exports__["d"] = isIosUIWebView;
./App/public/build/vendor.js:function isIosUIWebView(plt) {
./App/public/build/vendor.js: * UIWebView.
./App/public/build/vendor.js: // use JS scrolling for iOS UIWebView
./App/public/build/vendor.js: tapPolyfill: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["d" /* isIosUIWebView */],
./App/public/build/vendor.js: virtualScrollEventAssist: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["d" /* isIosUIWebView */],
./App/public/build/vendor.js: // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
./App/Pods/Pods.xcodeproj/project.pbxproj: 4102B43B35BAA23BF6211D54FD599A5B /* CDVUIWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C5B55D0A335AD21EB67E02786A06BF44 /* CDVUIWebViewDelegate.m */; };
./App/Pods/Pods.xcodeproj/project.pbxproj: 83EA0389A618ABD55700AF0E0EC720CC /* CDVUIWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A789EE277DC4A504A1E3EBA14AC5E55E /* CDVUIWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
./App/Pods/Pods.xcodeproj/project.pbxproj: A789EE277DC4A504A1E3EBA14AC5E55E /* CDVUIWebViewDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = CDVUIWebViewDelegate.h; sourceTree = "<group>"; };
./App/Pods/Pods.xcodeproj/project.pbxproj: C5B55D0A335AD21EB67E02786A06BF44 /* CDVUIWebViewDelegate.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = CDVUIWebViewDelegate.m; sourceTree = "<group>"; };
./App/Pods/Pods.xcodeproj/project.pbxproj: A789EE277DC4A504A1E3EBA14AC5E55E /* CDVUIWebViewDelegate.h */,
./App/Pods/Pods.xcodeproj/project.pbxproj: C5B55D0A335AD21EB67E02786A06BF44 /* CDVUIWebViewDelegate.m */,
./App/Pods/Pods.xcodeproj/project.pbxproj: 83EA0389A618ABD55700AF0E0EC720CC /* CDVUIWebViewDelegate.h in Headers */,
./App/Pods/Pods.xcodeproj/project.pbxproj: 4102B43B35BAA23BF6211D54FD599A5B /* CDVUIWebViewDelegate.m in Sources */,
./App/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h:#import "CDVUIWebViewDelegate.h"
./capacitor-cordova-ios-plugins/sources/CordovaPluginPrinter/APPPrinter.h:@interface APPPrinter : CDVPlugin <UIWebViewDelegate>
./capacitor-cordova-ios-plugins/sources/CordovaPluginPrinter/APPPrinter.m:#pragma mark UIWebViewDelegate
./capacitor-cordova-ios-plugins/sources/CordovaPluginPrinter/APPPrinter.m:- (void) webViewDidFinishLoad:(UIWebView *)webView
./capacitor-cordova-ios-plugins/sources/CordovaPluginPrinter/APPPrinter.m: UIWebView* page = [[UIWebView alloc] init];
./capacitor-cordova-ios-plugins/sources/CordovaPluginAppVersion/RareloopAppVersion.h:@interface RareloopAppVersion : CDVPlugin <UIWebViewDelegate>
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.h: #import <Cordova/CDVUIWebViewDelegate.h>
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.h:@interface CDVUIInAppBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.h: CDVUIWebViewDelegate* _webViewDelegate;
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.h:@property (nonatomic, strong) IBOutlet UIWebView* webView;
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVWKInAppBrowser.m: // Work around a bug where the first time a PDF is opened, all UIWebViews
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m: // UIWebView options
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webViewDidStartLoad:(UIWebView*)theWebView
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webViewDidFinishLoad:(UIWebView*)theWebView
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m: _webViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:self];
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m: self.webView = [[UIWebView alloc] initWithFrame:webViewBounds];
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:#pragma mark UIWebViewDelegate
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webViewDidStartLoad:(UIWebView*)theWebView
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webViewDidFinishLoad:(UIWebView*)theWebView
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m: // Work around a bug where the first time a PDF is opened, all UIWebViews
./capacitor-cordova-ios-plugins/sources/CordovaPluginInappbrowser/CDVUIInAppBrowser.m:- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
./capacitor-cordova-ios-plugins/sources/IonicPluginKeyboard/IonicKeyboard.m:// #import "UIWebViewExtension.h"
It is a lot less than the cordova + ionic app. I will investigate my plugins and mention them in the answer to provide help to other people in our situation. (File transfer is most likely one of them according to After migrate to capacitor still getting Apple warning related UIWebView)
Faulty plugins:
file-transfer (according to the article)
printer (according to the logs)