Skip to content

error: (DecodingError) typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: …, CodingKeys(stringValue: "shellScript", …)], debugDescription: "Expected to decode String but found an array instead.", …)) #921

Description

@F1248

Context 🕵️‍♀️

  • Xcode 16.3 (16E140)
  • Xcode project format: Xcode 16.3 (objectVersion = 90)
  • Periphery 3.0.3
  • XcodeProj 8.27.3

project.pbxproj:

// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 90;
	objects = {

…

/* Begin PBXShellScriptBuildPhase section */
		A42660D00000000000000000 /* Test Shell Script */ = {
			isa = PBXShellScriptBuildPhase;
			name = "Test Shell Script";
			shellPath = /bin/zsh;
			shellScript = (
				"echo 'Hello World!'",
				"",
			);
		};
/* End PBXShellScriptBuildPhase section */

…
	};
	rootObject = A42B35300000000000000000 /* Project object */;
}

What 🌱

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

error: (DecodingError) typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "objects", intValue: nil), _DictionaryCodingKey(stringValue: "A42660D12C729D04000E0507", intValue: nil), CodingKeys(stringValue: "shellScript", intValue: nil)], debugDescription: "Expected to decode String but found an array instead.", underlyingError: nil))

It seems that at least since Xcode project format 16.3 (objectVersion = 90), shell scripts (Targets → <target name> → Build PhasesNew Run Script Phase) are stored in arrays where each element represents a line, whereas before they were stored as a single string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions