Skip to content

Instantly share code, notes, and snippets.

@chetstone
Last active May 24, 2023 12:52
Show Gist options
  • Save chetstone/df3250abc7868fe5087e9f0b83a316d6 to your computer and use it in GitHub Desktop.
Save chetstone/df3250abc7868fe5087e9f0b83a316d6 to your computer and use it in GitHub Desktop.
Inspecting React-Native AsyncStorage in iOS Simulator

First, cd into the Async directory.

cd `xcrun simctl get_app_container booted $BUNDLE_ID data`/Documents/RCTAsyncLocalStorage_V1

Then review the manifest:

jq < manifest.json

Then to pretty-print a non-null value in the manifest:

jq '."somekey"|fromjson' < manifest.json

For null values, find the file that has the value:

md5 -s "otherkey"
90f5ba064f8280d4c94b1f0b1a85a79e

Then pretty-print that file:

jq < 90f5ba064f8280d4c94b1f0b1a85a79e

Helpful shell aliases

    export BUNDLE_ID=foo.bar.myApp
    alias cdasync='cd $(xcrun simctl get_app_container booted $BUNDLE_ID data)/Documents/RCTAsyncLocalStorage_V1'
    function jqkey {
        if  [[ $( cat  manifest.json | jq '.["'"$1"'"]' ) == null ]]
        then
            f=$(md5 -q -s $1)
            echo  NULL -- Printing file $f
            cat $f | jq
        else
            cat  manifest.json | jq '.["'"$1"'"]|fromjson'
        fi
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment