Skip to content

Commit b53d144

Browse files
author
Mickael Laloum
committed
Fix WebViewJavascriptBridge.js file loading when using cocoapods. Prefer bundleFromClass than mainBundle
1 parent 54ea698 commit b53d144

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

WebViewJavascriptBridge/WebViewJavascriptBridgeBase.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ - (void)flushMessageQueue:(NSString *)messageQueueString{
118118

119119
- (void)injectJavascriptFile:(BOOL)shouldInject {
120120
if(shouldInject){
121-
NSBundle *bundle = _resourceBundle ? _resourceBundle : [NSBundle mainBundle];
121+
NSBundle *bundle = _resourceBundle ? _resourceBundle : [NSBundle bundleForClass:self.class];
122122
NSString *filePath = [bundle pathForResource:@"WebViewJavascriptBridge.js" ofType:@"txt"];
123123
NSString *js = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
124124
[self _evaluateJavascript:js];

0 commit comments

Comments
 (0)