Xcode 16新建ShareExtension产生的PBXFileSystemSynchronizedRootGroup问题记录

503 阅读4分钟

Xcode16新建ShareExtenson之后的project.pbxproj和以前不一样,导致pod install等报错。

RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes: `{"isa"=>"PBXFileSystemSynchronizedRootGroup", "exceptions"=>["3DC73CB72CB8C2C1000F77DE"], "path"=>"demo", "sourceTree"=>"<group>"}`

If this ISA was generated by Xcode please file an issue:

......

现在将Xcode 14.3.116新建ShareExtensionproject.pbxproj文件的差异记录如下:

  1. PBXBuildFile section存在差异。
  • Xcode 14.3.1

image.png

81B617402CC60A000032D4E0 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81B6173F2CC60A000032D4E0 /* ShareViewController.swift */; };
81B617432CC60A000032D4E0 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81B617412CC60A000032D4E0 /* MainInterface.storyboard */; };
81B617472CC60A000032D4E0 /* AnShare.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 81B6173D2CC609FF0032D4E0 /* AnShare.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
  • Xcode 16

image.png

3D0F7DB82CC624F500030D67 /* AnShare.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 3D0F7DAE2CC624F500030D67 /* AnShare.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
  1. PBXFileReference section也存在差异。
  • Xcode 14.3.1

image.png

81B6173D2CC609FF0032D4E0 /* AnShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = AnShare.appex; sourceTree = BUILT_PRODUCTS_DIR; };
81B6173F2CC60A000032D4E0 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
81B617422CC60A000032D4E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
81B617442CC60A000032D4E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
  • Xcode 16

image.png

3D0F7DAE2CC624F500030D67 /* AnShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = AnShare.appex; sourceTree = BUILT_PRODUCTS_DIR; };
  1. Xcode 16 新增了2个section,PBXFileSystemSynchronizedBuildFileExceptionSetPBXFileSystemSynchronizedRootGroup

image.png

/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
           3D0F7DB92CC624F500030D67 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
           isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
           membershipExceptions = (
               Info.plist,
           );
           target = 3D0F7DAD2CC624F500030D67 /* AnShare */;
       };
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
           3D0F7DAF2CC624F500030D67 /* AnShare */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (3D0F7DB92CC624F500030D67 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = AnShare; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */
  1. Xcode 14.3.1PBXGroup section中有以下内容,而Xcode 16没有。

image.png

81B6173E2CC60A000032D4E0 /* AnShare */ = {
    isa = PBXGroup;
    children = (
        81B6173F2CC60A000032D4E0 /* ShareViewController.swift */,
        81B617412CC60A000032D4E0 /* MainInterface.storyboard */,
        81B617442CC60A000032D4E0 /* Info.plist */,
        );
        path = AnShare;
        sourceTree = "<group>";
};          
  1. PBXNativeTarget section也存在差异。
  • Xcode 14.3.1

image.png

81B6173C2CC609FF0032D4E0 /* AnShare */ = {
    isa = PBXNativeTarget;
    buildConfigurationList = 81B617532CC60A000032D4E0 /* Build configuration list for PBXNativeTarget "AnShare" */;
    buildPhases = (
        81B617392CC609FF0032D4E0 /* Sources */,
        81B6173A2CC609FF0032D4E0 /* Frameworks */,
        81B6173B2CC609FF0032D4E0 /* Resources */,
    );
    buildRules = (
    );
    dependencies = (
    );
    name = AnShare;
    productName = AnShare;
    productReference = 81B6173D2CC609FF0032D4E0 /* AnShare.appex */;
    productType = "com.apple.product-type.app-extension";
};
  • Xcode 16

image.png

3D0F7DAD2CC624F500030D67 /* AnShare */ = {
    isa = PBXNativeTarget;
    buildConfigurationList = 3D0F7DBA2CC624F500030D67 /* Build configuration list for PBXNativeTarget "AnShare" */;
    buildPhases = (
        3D0F7DAA2CC624F500030D67 /* Sources */,
        3D0F7DAB2CC624F500030D67 /* Frameworks */,
        3D0F7DAC2CC624F500030D67 /* Resources */,
    );
    buildRules = (
    );
    dependencies = (
    );
    fileSystemSynchronizedGroups = (
        3D0F7DAF2CC624F500030D67 /* AnShare */,
    );
    name = AnShare;
    packageProductDependencies = (
    );
    productName = AnShare;
    productReference = 3D0F7DAE2CC624F500030D67 /* AnShare.appex */;
    productType = "com.apple.product-type.app-extension";
  1. PBXProject section也存在差异。

image.png

  1. 如果objectVersion不是56,记得改为56

XcodeCocoapods没有给出解决方案前,如果需要,可以手动修改。