使用defaults操作plist

读取整个plist

# 使用相对路径是不行的
$ defaults read /Users/wangxuefeng/Desktop/ExportOptions.plist

{
    compileBitcode = 0;
    method = "ad-hoc";
    signingStyle = automatic;
    stripSwiftSymbols = 1;
    teamID = HV9T44VGD2;
    thinning = "";
}

读取某一项

$ defaults read /Users/wangxuefeng/Desktop/ExportOptions.plist method

ad-hoc

更新某一项

$ defaults write  /Users/wangxuefeng/Desktop/ExportOptions.plist method development

$ defaults read /Users/wangxuefeng/Desktop/ExportOptions.plist method              

development

删除某一项

// 有时候第三方提供的resouces.bundle里面包含CFBundleExecutable这一项,这会导致提交失败,要删除
defaults delete /Users/wangxuefeng/Desktop/Info.plist CFBundleExecutable

唯一需要注意的地方就是在指定plist文件路径时,使用相对路径是无效的。

你可能感兴趣的:(使用defaults操作plist)