Using Unity’s convenient plist class, you can easily add and modify keys and values in the Info.plist, but there doesn’t seem to be a way to remove keys. I need to remove the following lines when compiling for iOS 9.0 to not get any warnings from iTunes later when submitting, because they are deprecated / obsolete since iOS 9.0:
var file = new List<string>(System.IO.File.ReadAllLines(plistPath));
int removeStartIndex = -1;
int removeLineCount = -1;
for (int i = 0; i < file.Count; i++)
{
if(removeStartIndex == -1)
{
if(file[i].Contains("CFBundleIconFiles"))
{
removeStartIndex = i;
}
}
else
{
//on iOS, we're looking for the end of the array, while on tvOS
// that array is empty marked with a tag with a slash at the end
if(file[i].Contains("<array/>") || file[i].Contains("</array>"))
{
removeLineCount = i - removeStartIndex + 1; //+1 for current line
break;
}
}
}
file.RemoveRange(removeStartIndex, removeLineCount);
System.IO.File.WriteAllLines(plistPath, file.ToArray());