How to check your application is using any of the deprecated Apple APIs
Recently one of our iOS applications got rejected from Apple with the following messages.
ITMS-90809: Deprecated API Usage — New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Best regards,
The App Store Team
Currently, our application code base is too huge, few of the third party frameworks also contributed to this. We just wanted to get rid of this by searching a file which is using the deprecated API. We came up with the elegant solution using Unix grep command.
We can use grep command to search for a particular character string in a file, The basic syntax of the grep command is:
$ grep [options] string file
where string is the word or phrase you want to find, and file is the file to be searched.
Lets’s search for the word UIWebView now using the above command.
grep -r UIWebView .
The above command is straight forward. It recursively(option -r) searches the word UIWebView inside the current directory(which is specified dot (.))
We have a problem here. The above command is just enough for the application which doesn’t use any of the third-party frameworks.
As said, our application also uses multiple frameworks. To get a list of frameworks that uses the deprecated API we have used the following steps.
Build the application and right-click on the archive to show package contents and from terminal change the current directory to that show package content directory and execute the following shell script command.
for framework in Frameworks/*.framework; do
fname=$(basename $framework .framework)
echo $fname
nm $framework/$fname | grep UIWebView
done
Here is the hint that shows which frameworks are using UIWebView
That’s it for now. Happy coding!!!