Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
WaqasGameDev opened this issue Feb 25, 2025 · 0 comments
Open

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

WaqasGameDev opened this issue Feb 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@WaqasGameDev
Copy link

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

@WaqasGameDev WaqasGameDev added the bug Something isn't working label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant