Moving Xcode's .xcframework to another location programmatically

63 Views Asked by At

I'm trying to move xcframework into the root folder of my project's main build target (Unity-IPhone).

When I drag & drop, as shown on the screenshots - it builds properly, and I can archive properly and upload to store. Everything works.

enter image description here

enter image description here

enter image description here

When I do it programmatically however, I get App Store Upload errors:

IASDKCore.xcframework is not contained in a correctly named directory. It should be under "Frameworks"

To do it programmatically I use Unity's API's (PBXProject.AddFile() etc.):

    List<string> frameworks = new List<string> {
        Path.Combine("Pods", "Fyber_Marketplace_SDK", "IASDKCore", "IASDKCore.xcframework"),
        Path.Combine("Pods", "smaato-ios-sdk", "vendor", "OMSDK_Smaato.xcframework"),
    };
    
    foreach (string framework in frameworks) {
        var t = framework.Split("/")[^1];
        var frameworkPath = project.AddFile(src, t );
        var newFileGUID = project.FindFileGuidByProjectPath(t);

        project.AddFileToBuild(mainTargetGuid, newFileGUID);
        project.AddFileToEmbedFrameworks(mainTargetGuid, newFileGUID);
    }

I can see the file in Xcode in the root folder, added as a reference, but something is still wrong.

Do you guys have any ideas? What actually happens inside XCode when I drag & drop the file? I'm trying to recreate it through code but can't get it working.

0

There are 0 best solutions below