kronenthaler/mod-pbxproj

[BUG] mod-pbxproj doesn't work with Xcode project created by QT framework.

lszczesi opened this issue · 2 comments

System information

  1. pbxproj version used: 2.0.1
  2. python version used: 3.7.7
  3. Xcode version used: 11.3

I tried to use pbxproj on my xcode project that is being generated by qt. When i run it over my project with example code

from pbxproj import XcodeProject

# open the project
project = XcodeProject.load('app.xcodeproj/project.pbxproj')

i get following error

  File "./modify_xcode_proj_script.py", line 4, in <module>
    project = XcodeProject.load('app.xcodeproj/project.pbxproj') 
  File "<path>/pbxproj/XcodeProject.py", line 93, in load
    return XcodeProject(tree, path)
  File "<path>/pbxproj/XcodeProject.py", line 35, in __init__
    self.objects[file_id]._section = comment
AttributeError: 'NoneType' object has no attribute '_section'

When i run it with new empty xcode project or even very simple xcode made by qt everything works fine. Here is *.pbxproj I'm using scrypt on:
removed project link for security reasons

Thanks for your report. After a quick check up, it seems that your project has broken references. If you search for 5B0FB040241C32F3BEB4F1A1, you will notice that it appears only once in the project. Normally, any reference should appear at least twice, once when defined and once where referenced. In the case of that file, it's only referenced, but never defined.

I wonder if you try to compile that project as-is in Xcode does it yield any compilation errors? Maybe Xcode is a bit lenient because the missing reference is a resource?

All that being said, I think some hardening needs to happen around this area. I will keep the bug opened. I hope this answer helps you out.

Thaks for help. Yes, xcode build without any errors. Most likely I have some reference in my qt code to file that does not exist. Will try to fix it and then try running script on it again.