How to read current app version in Xcode 11 with script

前端 未结 9 1777
野趣味
野趣味 2020-12-14 00:38

Until Xcode 11, I used a script that reads the current app version (for the AppStore) and help me change the LaunchScreen since we can\'t use swift for that

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 01:09

    For Node.js: there is xcode package. Example of usage:

    const xcode = require('xcode');
    
    const project = xcode.project('ios/PROJECT_NAME.xcodeproj/project.pbxproj').parse(() => {
      const config = project.pbxXCBuildConfigurationSection();
      const releaseScheme = Object.keys(config).find(key => config[key].name === 'Release');
    
      const version = config[releaseScheme].buildSettings.MARKETING_VERSION;
    });
    

    Previously I used the plist package, but with latest xCode changes it became outdated, since I'm not able to extract a version from Info.plist for React Native projects.

提交回复
热议问题