Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Deleting .xib from xcode build and remove reference

Discussion in 'iOS and tvOS' started by totsboy, Dec 15, 2016.

  1. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Hello,

    I'm trying to automate the process of deleting the .xib from my xcode build.
    To simply delete the file I'm using this on postProcessBuild:

    FileUtil.DeleteFileOrDirectory(path+"/LaunchScreen-iPad.xib");

    But xcode still has reference to the file so I have to manually remove it from the project as well in order to run the build. Is there any way to make this work?

    The other thing I'm trying to do is remove the Launch Images from Image.xcassets (retina HD 4.7 and retina hd 5.5) in order to run the game in display zoom mode. Any ideas on how to do that?

    Thanks!
     
  2. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    You need to use Xcode API. Something like FindFileByProjectPath and RemoveFile should do what you want.
     
  3. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    Even using RemoveFile Xcode still has the reference =/
     
  4. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
    Remember to save the xcode project after removing the file.
    Code (CSharp):
    1. xcodeProject.RemoveFile(fileGuid);
    2. xcodeProject.WriteToFile(xcodeProjectPath);