Skip to content

Commit

Permalink
fix(ios): correctly initialize cordova plugins with webViewEngine (#4039
Browse files Browse the repository at this point in the history
)
  • Loading branch information
timbru31 committed Jan 12, 2021
1 parent 845bf48 commit 273fab5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ extern NSString* const CDVViewWillTransitionToSizeNotification;

@interface CDVPlugin : NSObject {}

- (instancetype)initWithWebViewEngine:(WKWebView *)theWebViewEngine;
@property (nonatomic, weak) UIView* webView;
@property (nonatomic, weak) WKWebView * webViewEngine;
@property (nonatomic, strong) NSString * className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ - (CDVPlugin *)getCommandInstance:(NSString*)pluginName

id obj = [self.pluginObjects objectForKey:className];
if (!obj) {
obj = [[NSClassFromString(className)alloc] init];
obj = [[NSClassFromString(className)alloc] initWithWebViewEngine: self.webView];
if (!obj) {
NSString* fullClassName = [NSString stringWithFormat:@"%@.%@",
NSBundle.mainBundle.infoDictionary[@"CFBundleExecutable"],
className];
obj = [[NSClassFromString(fullClassName)alloc] init];
obj = [[NSClassFromString(fullClassName)alloc] initWithWebViewEngine: self.webView];
}

if (obj != nil) {
Expand Down

0 comments on commit 273fab5

Please sign in to comment.