GithubHelp home page GithubHelp logo

imywebview's People

Contributors

fengqiangboy avatar li6185377 avatar walkdianzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imywebview's Issues

为什么要把NJKWebViewProgress 集成进去?

我看项目中copy了NJKWebViewProgress 的部分代码,为什么不直接用Pod 引用?

要是copy了,把NJKWebViewProgressView 也copy一份啊!现在我手动加入 NJKWebViewProgress 的库,还出现 completeRPCURL 变量符号冲突。

拿到jscontext的方式无法统一

UIWebView可以从
valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"
拿到jscontext,但WKWebView要从
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message;
回调里面拿到js的信息,完全是两种不同的用法,有办法统一吗

无法调用js方法

JSContext * context = [(UIWebView *)webView.realWebView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
NSString * alertJS = @"alert('test js OC')"; //准备执行的js代码
[context evaluateScript:alertJS];

崩在第一句

崩溃

*** Terminating app due to uncaught exception 'BadWebViewType', reason: 'Unknown web view type.'
*** First throw call stack:

ios 12 奔溃在 uiwebview 初始化 怎么解决

后台统计发现 ios12 有部分闪退 都是

WebCore WebCore::FrameLoader::checkCompleted() + 592
1 WebCore WebCore::FrameLoader::init() + 740
2 WebCore WebCore::FrameLoader::init() + 740
3 WebKitLegacy +[WebFrame(WebInternal) _createMainFrameWithPage:frameName:frameView:] + 332
4 WebKitLegacy -[WebView(WebPrivate) _commonInitializationWithFrameName:groupName:] + 2924
5 WebKitLegacy -[WebView(WebPrivate) _initWithFrame:frameName:groupName:] + 132
6 UIKitCore -[UIWebDocumentView initWithWebView:frame:] + 320
7 UIKitCore -[UIWebBrowserView initWithWebView:frame:] + 48
8 UIKitCore -[UIWebBrowserView initWithFrame:] + 44
9 UIKitCore -[UIWebView _webViewCommonInitWithWebView:scalesPageToFit:] + 244
10 UIKitCore -[UIWebView initWithFrame:] + 76
11 TfClient -[IMYWebView initUIWebView] (IMYWebView.m:134)
12 TfClient -[IMYWebView _initMyself] (IMYWebView.m:92)

知道是什么原因吗

关于redme 中的警告,可能找到了原因

-(void)setScalesPageToFit:(BOOL)scalesPageToFit
把上面个方法中的 那段js代码删掉 就好了 ,因为淘宝的页面 已经包含了viewport mate标签,并且 witdh= 0.333 , 你那段js改成了witdh= 1. 。。。 所以 放大了

建议WKWebViewConfiguration初始化另起方法,方便子类能继承修改

  • (void)initWKWebView
    {
  • WKWebViewConfiguration* configuration = [[NSClassFromString(@"WKWebViewConfiguration") alloc] init];
  • configuration.userContentController = [NSClassFromString(@"WKUserContentController") new];
  • WKPreferences* preferences = [NSClassFromString(@"WKPreferences") new];
  • preferences.javaScriptCanOpenWindowsAutomatically = YES;
  • configuration.preferences = preferences;
  • WKWebView* webView = [[NSClassFromString(@"WKWebView") alloc] initWithFrame:self.bounds configuration:configuration];
  • WKWebView* webView = [[NSClassFromString(@"WKWebView") alloc] initWithFrame:self.bounds configuration:[self configuration]];
    webView.UIDelegate = self;
    webView.navigationDelegate = self;
  • (WKWebViewConfiguration*)configuration
    {
    WKWebViewConfiguration* configuration = [[NSClassFromString(@"WKWebViewConfiguration") alloc] init];
    configuration.userContentController = [NSClassFromString(@"WKUserContentController") new];

    WKPreferences* preferences = [NSClassFromString(@"WKPreferences") new];
    preferences.javaScriptCanOpenWindowsAutomatically = YES;
    configuration.preferences = preferences;
    return configuration;
    }

setScalesPageToFit导致的布局bug

-(void)setScalesPageToFit:(BOOL)scalesPageToFit;

        NSMutableArray* array = [NSMutableArray arrayWithArray:webView.configuration.userContentController.userScripts];
        for (WKUserScript *wkUScript in array)
        {
            if([wkUScript.source isEqual:jScript])
            {
                [array removeObject:wkUScript];
                break;
            }
        }
        for (WKUserScript *wkUScript in array)
        {
            [webView.configuration.userContentController addUserScript:wkUScript];
        }

这一段存在bug

在for之前需要加入
[webView.configuration.userContentController removeAllUserScripts];
不然没有移除相关的js

首次进来是uiwebview 再次进来就是wkwebview 了 这是不是个bug

我们的程序目前兼容iOS7 想 iOS7用uiwebview iOS8 用wkwebivew 。 你的这个demo 里第一次加载是webview吧 第二次 加载才用的是wkwebview 。 我们应用中有一个全是图片的html 高度 5w多。 测试手机6plus 测试结果 使用UIWebview 内存挂掉。 使用wkwebview
内容加载不出来。 计算高度采用的是添加观察者。

如何处理javascirpt 的alert\confirm\prompt 的

wkWebView 实现UIDelegate 等代理方法后 例如runJavaScriptAlertPanelWithMessage ,在某些特定场合会崩溃,例如wKwebview 执行js alert时,wkWebview的控制器有push或present 动画未完成时会崩溃。 请问你是怎么处理的

内存泄露的问题

[config.userContentController addScriptMessageHandler:self name:@"xxx"];可能会对self强引用造成内存泄露,在removeScriptMessageHandlerForName之后可以解决这个问题但是删除之后再次添加 就调不起js了有什么 好的解决办法没有。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.