tuist / XcodeProj

📝 Read, update and write your Xcode projects
https://xcodeproj.tuist.io
MIT License
2.04k stars 313 forks source link

`error: (DecodingError) typeMismatch(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "preferredProjectObjectVersion", intValue: nil)] […]))` #861

Closed F1248 closed 1 month ago

F1248 commented 1 month ago

Context 🕵️‍♀️

project.pbxproj:

// !$*UTF8*$!
{
    objectVersion = 77;
    objects = {
[…]
/* Begin PBXProject section */
        XXXXXXXXXXXXXXXXXXXXXXXX /* Project object */ = {
            isa = PBXProject;
            […]
            preferredProjectObjectVersion = 77;
            […]
        };
/* End PBXProject section */
[…]
    };
    rootObject = XXXXXXXXXXXXXXXXXXXXXXXX /* Project object */;
}

What 🌱

When I try to scan my project with Periphery, that uses XcodeProj, with periphery scan, I get this error message:

error: (DecodingError) typeMismatch(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "preferredProjectObjectVersion", intValue: nil)], debugDescription: "Expected to decode Int but found a string instead.", underlyingError: nil))

It seems that for my project, #854 doesn't work as expected.

pepicrft commented 1 month ago

@F1248 would you mind including a small Xcode project where we can reproduce the issue?

F1248 commented 1 month ago

@pepicrft

I created this project from scratch using Xcode 16.1 beta 2 (16B5014f): Create New Project…MultiplApp

% cd Test
% periphery scan --setup
Welcome to Periphery!
This guided setup will help you select the appropriate configuration for your project.

* Inspecting project...

error: (DecodingError) typeMismatch(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "preferredProjectObjectVersion", intValue: nil)], debugDescription: "Expected to decode Int but found a string instead.", underlyingError: nil))
aksh1t commented 1 month ago

I can reproduce this as well on a fresh iOS project created with Xcode 16 (16A242d).

pepicrft commented 1 month ago

I opened a PR addressing the issue

aksh1t commented 1 month ago

Can confirm your PR fixes the issue! Thanks for the quick fix!