stringByEvaluatingJavaScriptFromString doesn't always seem to work

一个人想着一个人 提交于 2019-12-09 04:53:28

Yes, there are limits placed upon the stringByEvaluatingJavaScriptFromString method. The two you need to know about:

  • JavaScript allocations greater than 10MB are not allowed
  • JavaScript that takes longer than 10 seconds to execute is not allowed

In the former, you'll get an exception generated, but in the latter it may well fail 'silently'. Are you testing the return value of the method? If it fails it will return nil. This can be a useful way to see if your script is being terminated by the OS due to one of the reasons above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!