V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
xi_lin
V2EX  ›  iDev

在 UIWebView 中取得 JSContext 审核会被拒不?

  •  
  •   xi_lin · 2015-09-07 11:01:48 +08:00 · 4721 次点击
    这是一个创建于 3160 天前的主题,其中的信息可能已经有所发展或是发生改变。


    self.context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
    取得 JSContext 的方法会不会审核被拒?
    查了下拒不拒都有例子。。不敢用了都

    12 条回复    2015-09-07 23:16:50 +08:00
    jhdxr
        1
    jhdxr  
       2015-09-07 11:29:16 +08:00   ❤️ 1
    没因为这个悲剧过
    lynulzy
        2
    lynulzy  
       2015-09-07 13:09:00 +08:00   ❤️ 1
    为什么会悲剧
    siroccoicode
        3
    siroccoicode  
       2015-09-07 13:55:20 +08:00
    不会,从 iOS8.2 开始允许使用 JavascriptCore 来动态执行代码。
    xi_lin
        4
    xi_lin  
    OP
       2015-09-07 14:39:38 +08:00   ❤️ 1
    @jhdxr 那就好~
    xi_lin
        5
    xi_lin  
    OP
       2015-09-07 14:40:06 +08:00   ❤️ 1
    @lynulzy 因为 documentView.webView.mainFrame.javaScriptContext 不在官方文档里
    xi_lin
        6
    xi_lin  
    OP
       2015-09-07 14:40:20 +08:00   ❤️ 1
    @siroccoicode 在 iOS7 上用呢?
    DingSoung
        7
    DingSoung  
       2015-09-07 14:47:52 +08:00   ❤️ 1
    不会,用过。
    lynulzy
        8
    lynulzy  
       2015-09-07 15:06:37 +08:00
    和这个方法的效果一样吧?

    - stringByEvaluatingJavaScriptFromString:
    siroccoicode
        9
    siroccoicode  
       2015-09-07 20:45:07 +08:00
    @xi_lin 准确说是从 iOS7 开始公开了 JSC 的接口,发布 iOS8.2 的时候修改了开发者协议,内容如下

    > 3.3.2 An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple's built-in WebKit framework, provided that such scripts and code do not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store.

    实际上就意味着允许开发者直接使用 JavascriptCore 接口来进行一些更加``奇妙``的操作
    xi_lin
        10
    xi_lin  
    OP
       2015-09-07 23:15:37 +08:00
    @dingsoung thanks
    xi_lin
        11
    xi_lin  
    OP
       2015-09-07 23:16:19 +08:00
    @lynulzy 主要是想简化 js -> native 这一步,有了 JSContext 就可以直接 JSExport 直接调用方法了
    xi_lin
        12
    xi_lin  
    OP
       2015-09-07 23:16:50 +08:00
    @siroccoicode 原来如此,谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1821 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:45 · PVG 08:45 · LAX 17:45 · JFK 20:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.