Skip to content

App Store does not let upload ios static library as embedded #321

Closed
@WaqasGameDev

Description

@WaqasGameDev

Describe the bug

Hi, I was trying to upload ios build using static library of yours and I found 2 issues in your build scripts causing issues.

  1. Since you copy static library at build time from streaming assets to plugins folder, by default unity marks the Add to Embedded Binaries flag true which was causing your static library to be embedded as a binary into frameworks instead of just linking as a library. I had to use this post build script to fix that.
public static void FixLLMIOSPlugins()
{
  // Path to your .a in Plugins/iOS (relative to Assets)
  string pluginPath = "Assets/Plugins/iOS/LLMUnity/undreamai-v1.2.1-llamacpp/libundreamai_ios.a";

  // Attempt to get the PluginImporter for this file
  var importer = AssetImporter.GetAtPath(pluginPath) as PluginImporter;
  if (importer == null)
  {
    Debug.LogError($"Could not find PluginImporter at path: {pluginPath}");
    return;
  }

  // Ensure it’s enabled for iOS, but not embedded
  importer.SetCompatibleWithPlatform(BuildTarget.iOS, true);

  // Different Unity versions name these keys slightly differently,
  // but typically "AddToEmbeddedBinaries" or "AddToXcodeEmbeddedFrameworks"
  importer.SetPlatformData(BuildTarget.iOS, "AddToEmbeddedBinaries", "false");

  // Make sure it’s added to Xcode, so it gets linked
  importer.SetPlatformData(BuildTarget.iOS, "AddToXcode", "true");

  // Some Unity versions also have:
  //   importer.SetPlatformData(BuildTarget.iOS, "AddToXcodeLinkFramework", "true");

  importer.SaveAndReimport();

  Debug.Log("Fixed iOS plugin import settings for: " + pluginPath);
}
  1. After copying the library, your build scripts did not delete original files from streaming assets so it was being ended copied as raw files into ipa and app store did not allow it. So I had to make sure to remove them as well.

It would be great if you can fix these issues for future releases. Thanks,

Steps to reproduce

No response

LLMUnity version

No response

Operating System

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions