Search Unity

NullReferenceException when calling PBXProject.ReadFromFile

Discussion in 'Editor & General Support' started by halilkayim, Aug 10, 2018.

  1. halilkayim

    halilkayim

    Joined:
    Feb 27, 2018
    Posts:
    21
    I have a post-build scrip that manages some references in my iOS project after build is complete. I have the following line somewhere in my script:

    Code (CSharp):
    1. var pbx = new PBXProject();
    2. var pbxPath = Path.Combine(XcodeProjectRoot, PbxFilePath);
    3. pbx.ReadFromFile(pbxPath);
    When executing the last line, I get a NullReferenceException with the following stack trace:
    It seems like the PBXProject object is created just fine, but there seems to be an error regarding the actual .pbxproj file. The stack trace shows that it's trying to repair some missing references, but my iOS project runs just fine.

    Any ideas on how to fix this problem?
     
    cloutiertyler likes this.