function handleBuildSettings()

in lib/prepare.js [284:357]


function handleBuildSettings (platformConfig, locations, infoPlist) {
    let project;

    try {
        project = projectFile.parse(locations);
    } catch (err) {
        return Promise.reject(new CordovaError(`Could not parse ${locations.pbxproj}: ${err}`));
    }

    const pkg = platformConfig.getAttribute('ios-CFBundleIdentifier') || platformConfig.packageName();
    const name = platformConfig.name();
    const version = platformConfig.version();
    const displayName = platformConfig.shortName();
    const CFBundleVersion = platformConfig.getAttribute('ios-CFBundleVersion') || default_CFBundleVersion(version);

    events.emit('verbose', `Set PRODUCT_BUNDLE_IDENTIFIER to ${pkg}.`);
    project.xcode.updateBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', `"${pkg}"`, null, 'App');

    events.emit('verbose', `Set PRODUCT_NAME to ${name}.`);
    project.xcode.updateBuildProperty('PRODUCT_NAME', `"${name}"`, null, 'App');

    events.emit('verbose', `Set MARKETING_VERSION to ${version}.`);
    project.xcode.updateBuildProperty('MARKETING_VERSION', version, null, 'App');

    events.emit('verbose', `Set CURRENT_PROJECT_VERSION to ${CFBundleVersion}.`);
    project.xcode.updateBuildProperty('CURRENT_PROJECT_VERSION', CFBundleVersion, null, 'App');

    if (displayName !== name) {
        events.emit('verbose', `Set INFOPLIST_KEY_CFBundleDisplayName to ${displayName}.`);
        project.xcode.updateBuildProperty('INFOPLIST_KEY_CFBundleDisplayName', `"${displayName}"`, null, 'App');
    } else {
        project.xcode.updateBuildProperty('INFOPLIST_KEY_CFBundleDisplayName', '"$(PRODUCT_NAME)"', null, 'App');
    }

    const targetDevice = parseTargetDevicePreference(platformConfig.getPreference('target-device', 'ios'));
    if (targetDevice) {
        events.emit('verbose', `Set TARGETED_DEVICE_FAMILY to ${targetDevice}.`);
        project.xcode.updateBuildProperty('TARGETED_DEVICE_FAMILY', targetDevice);
    }

    const deploymentTarget = platformConfig.getPreference('deployment-target', 'ios');
    if (deploymentTarget) {
        events.emit('verbose', `Set IPHONEOS_DEPLOYMENT_TARGET to "${deploymentTarget}".`);
        project.xcode.updateBuildProperty('IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget);
    }

    const swiftVersion = platformConfig.getPreference('SwiftVersion', 'ios');
    if (swiftVersion) {
        events.emit('verbose', `Set SwiftVersion to "${swiftVersion}".`);
        project.xcode.updateBuildProperty('SWIFT_VERSION', swiftVersion);
    }

    handleOrientationSettings(platformConfig, project);

    project.write();

    // If we have a Podfile, we want to update the deployment target there too
    const podPath = path.join(locations.root, Podfile.FILENAME);
    if (deploymentTarget && fs.existsSync(podPath)) {
        const project_name = locations.xcodeCordovaProj.split(path.sep).pop();

        const PodsJson = require('./PodsJson').PodsJson;
        const podsjsonFile = new PodsJson(path.join(locations.root, PodsJson.FILENAME));
        const podfileFile = new Podfile(podPath, project_name, deploymentTarget);
        podfileFile.write();

        events.emit('verbose', 'Running `pod install` (to install plugins)');
        projectFile.purgeProjectFileCache(locations.root);
        return podfileFile.install(check_reqs.check_cocoapods)
            .then(() => podsjsonFile.setSwiftVersionForCocoaPodsLibraries(locations.root));
    }

    return Promise.resolve();
}