RN build info
npm install react-native-native-build-info
import { getBuildTime } from "react-native-native-build-info";
// ...
const result = await getBuildTime();
add this line to app/android/build.gradle
android {
defaultConfig {
...
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
}
}
add Run Script phase to the very bottom of Build Phases, add script below, clean & rebuild
infoplist="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
builddate=`date`
if [[ -n "$builddate" ]]; then
/usr/libexec/PlistBuddy -c "Add :CFBuildDate $builddate" ${infoplist}
/usr/libexec/PlistBuddy -c "Set :CFBuildDate $builddate" ${infoplist}
fi
MIT