- Home /
How to automatically replace the .xib file in the Xcode project when packaging iOS
Now that I am maintaining the automatic packaging tool, I have now implemented automatic replacement of the .plist file, but I don't know how to replace the .xib file on the boot screen.
Comment
[Serializable]
[LabelText("iOS")]
public class IosCommonSetting : PlatformCommonSetting
{
public string build;
[FilePath(AbsolutePath = true)]
public string plistPath;
[FilePath(AbsolutePath = true)]
public string xibPath;
public override void Apply()
{
base.Apply();
PlayerSettings.iOS.buildNumber = build;
if (!string.IsNullOrEmpty(plistPath))
{
AutoBuilder.current.onBuildSucceed -= $$anonymous$$odifyPlist;
AutoBuilder.current.onBuildSucceed += $$anonymous$$odifyPlist;
}
if (!string.IsNullOrEmpty(xibPath))
{
AutoBuilder.current.onBuildSucceed -= $$anonymous$$odifyXib;
AutoBuilder.current.onBuildSucceed += $$anonymous$$odifyXib;
}
}
private void $$anonymous$$odifyPlist()
{
#if UNITY_IOS
var plist = new UnityEditor.iOS.Xcode.PlistDocument();
plist.ReadFromFile(plistPath);
plist.root.SetString("CFBundleShortVersionString", version);
plist.root.SetString("CFBundleVersion", build);
plist.WriteToFile(string.Format("{0}/Info.plist", AutoBuilder.current.outputPath));
#endif
}
private void $$anonymous$$odifyXib()
{
//#if UNITY_IOS
//var plist = new UnityEditor.iOS.Xcode
//plist.ReadFromFile(xibPath);
//plist.WriteToFile(string.Format("{0}/LaunchScreen-iPad.xib", AutoBuilder.current.outputPath));
//#endif
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612184657im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Creating a native photo picker screen on iOS 2 Answers
Black screen while running in iOS 4 Answers
Set Screen Size To Only Be Wide? 1 Answer
Any idea on when we'll see Unity work with Xcode 4? 3 Answers