apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 986 forks source link

(iOS) Project changes to allow consuming cordova as submodule #1015

Closed wmathurin closed 3 years ago

wmathurin commented 3 years ago

Platforms affected

iOS

Motivation and Context

If your application consumes cordova as a submodule and depends on the cordova dynamic framework, it will fail to run properly because the web view engine classes are not in the framework. As a result, CDVViewController fails to build the web view engine by reflection.

self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];

And the view controller is never unhidden.

Description

The change simply adds the cordova framework as a target for the web view engine classes.

Testing

In https://github.com/forcedotcom/salesforceMobileSDK-ios-hybrid, we consume cordova through a submodule. We have several sample apps as well as suites of tests. The change allowed the apps to run properly and the tests to pass.

Checklist

wmathurin commented 3 years ago

The PR is not making them public but make them part of the framework target.

The fallback is here: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVViewController.m#L508

Because the class is not in the framework, it fails to find the class at runtime.

When you consume cordova through cocoapod, the class is available because we have

cordova.source_files = 'CordovaLib/Classes/**/*.{h,m}', 'CordovaLib/Cordova/Cordova.h'

in https://github.com/apache/cordova-ios/blob/master/Cordova.podspec#L41.

codecov-io commented 3 years ago

Codecov Report

Merging #1015 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1015   +/-   ##
=======================================
  Coverage   74.91%   74.91%           
=======================================
  Files          13       13           
  Lines        1718     1718           
=======================================
  Hits         1287     1287           
  Misses        431      431           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cb20c9b...d1b6496. Read the comment docs.