JSPatch bridge Objective-C and Javascript using the Objective-C runtime. You can call any Objective-C class and method in JavaScript by just including a small engine. JSPatch is generally used to hotfix iOS App.
MIT License
11.37k
stars
2.24k
forks
source link
用performSelectorInOC创建网页后,出现错误提示:TypeError: undefined is not an object (evaluating 'webView.__c') #811
我用的是: 1)付费的JSPatchSDK 2)Xcode 9.2 3)真机进行测试 4)下面的是js核心代码: 5)我添加了require('UIWebView,NSURL,NSURLRequest'); require('UIWebView,NSURL,NSURLRequest'); defineClass("JPViewController", { viewDidLoad: function() { var slf = self; return UIWebView.alloc().performSelectorInOC('initWithFrame:', [self.view().bounds()],function(webView){ var url = NSURL.alloc().initWithString("http://www.apple.com"); webView.loadRequest(NSURLRequest.requestWithURL(url)); slf.view().addSubview(webView); }); } },{}); 如果不添加require('UIWebView,NSURL,NSURLRequest');的话,会报语法错误的,我已经添加了。希望大佬答疑解惑,小弟感激不尽!