Skip to content

Instantly share code, notes, and snippets.

@ewanharris
Last active January 11, 2021 08:55
Show Gist options
  • Save ewanharris/bf7aa969dd0a99cd83c019feb512e800 to your computer and use it in GitHub Desktop.
Save ewanharris/bf7aa969dd0a99cd83c019feb512e800 to your computer and use it in GitHub Desktop.
Script to check Titanium modules for references to UIWebView
#!/usr/bin/env bash
FOLDER=$1
echo "Checking $FOLDER"
# Check for references to UIWebView in the build .a files using strings
for file in "$FOLDER"/*.a; do
strings "$file" | grep UIWeb > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$file contains references to UIWebView"
fi
done
# Check for references to UIWebView in the bundled framework files
PLATFORM_FOLDER=$FOLDER/platform
if [[ -d "$PLATFORM_FOLDER" ]]
then
for file in "$PLATFORM_FOLDER"/*.framework; do
fname=$(basename "$file" .framework)
nm "$file"/$fname 2> /dev/null | grep UIWeb > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$file contains references to UIWebView"
fi
done
fi

Usage

  1. Create a file called check-modules.sh and copy the above contents into the file
  2. Ensure that file has executable permissions chmod +x <path>
  3. Run the file against each module ./check-modules <path> where path is the full path of a module including the platform and version. Making sure to either escape the spaces (like below) or wrapping your path in quotes
  • For example ./check-module.sh /Users/awam/Library/Application\ Support/Titanium/modules/iphone/ti.googlesignin/2.0.4

If the module contains UIWebView references then that will be logged

@chmiiller
Copy link

Awesome tool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment