How to search for any UIWebView component usage inside a current project? How to search for any UIWebView component usage inside a current project? xcode xcode

How to search for any UIWebView component usage inside a current project?


Hey I tried searching in Xcode.Couple of the third party libraries used it. (FBSDK for example)I updated those libraries but that wasn't sufficient.

On the next upload the scary email arrived again.

Then I found this article:https://medium.com/@zivchen_42755/for-me-that-wasnt-enough-it-didn-t-found-all-of-them-thats-weird-something-to-do-with-pod-i-a068d55b7fab

and in the comments someone mentioned grep being the medicine.

So I tried grep -r UIWebView /Path/To/Project/*

And it found a couple of the binary frameworks that also use UIWebView. (GoogleSignin, Crashlytics ...) I updated those too.

On the next upload there was no scary email :D


You can find by using below command lines in your project.

$ cd yourprojectpath$ grep -r "UIWebView" .


grep -r UIWebView works fine for sources but partially for 3rd party binaries because from one side they can contain references, comments or string data with UIWebView without actually using the API and from the other they can use it but doesn't have any reference about.

To check binaries (app, static libs or dynamic frameworks) you should get symbols table with nm (llvm symbol table dumper) e.g.:

nm staticlib.a | grep UIWebView0000000100117c38 t +[UIWebView(SCORVCE) load]0000000100117c30 t +[UIWebView_SCORVCE_Importer import]0000000100117ea4 t -[UIWebView(SCORVCE) vce_delegate]0000000100117d54 t -[UIWebView(SCORVCE) vce_setDelegate:]000000010012880c t -[VCETrack setUsingUIWebView:]00000001001287fc t -[VCETrack usingUIWebView]                 U _OBJC_CLASS_$_UIWebView0000000100640668 s _OBJC_CLASS_$_UIWebView_SCORVCE_Importer0000000100639f88 s _OBJC_IVAR_$_VCETrack._usingUIWebView0000000100640640 s _OBJC_METACLASS_$_UIWebView_SCORVCE_Importer0000000100117ca0 t ___26+[UIWebView(SCORVCE) load]_block_invoke

For frameworks you should do the same with its binary file:

nm MyFramework.framework/MyFramework | grep UIWebView

Finally to be sure that the app doesn't use UIWebView you should make an archive then find your app file (YourApp.app) and run next script inside:

# Check the app with static librariesecho "YourApp"nm YourApp | grep UIWebView# Check dynamic frameworksfor framework in Frameworks/*.framework; do  fname=$(basename $framework .framework)  echo $fname".framework"  nm $framework/$fname | grep UIWebViewdone