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 with MediaPipeUnity instantly crashes on startup on iOS (Library not loaded) #880

Closed
spvn opened this issue Mar 24, 2023 · 6 comments · Fixed by #882
Closed

App with MediaPipeUnity instantly crashes on startup on iOS (Library not loaded) #880

spvn opened this issue Mar 24, 2023 · 6 comments · Fixed by #882
Labels
type:support Support issue

Comments

@spvn
Copy link

spvn commented Mar 24, 2023

Plugin Version or Commit ID

v0.11.0

Unity Version

2021.3.16f

Your Host OS

Windows 10

Target Platform

iOS

Description

I'm using the pre-built libraries provided in the unitypackage file. When building for iOS, the app instantly crashes on startup with errors like "Library not Loaded" and "(errno=2) Not in dyld cache". Unfortunately I don't have access to the error logs currently but I'll edit this and paste them in later.

I've already ensured that the plugin file is in the correct folder (Packages\com.github.homuler.mediapipe\Runtime\Plugins\iOS\MediaPipeUnity.framework). It even shows up in XCode as one of the frameworks. I tried forcing it to be included by changing it from "Do not Embed" to "Embed & Sign" but still to no avail. I feel like I must be missing some simple step but I can't figure out what I'm doing wrong.

The app works perfectly fine on Android.

Thanks @homuler for this plugin regardless, it's been a lifesaver.

Code to Reproduce the issue

No response

Additional Context

No response

@spvn spvn added the type:support Support issue label Mar 24, 2023
@spvn
Copy link
Author

spvn commented Mar 27, 2023

Full logs:

2023-03-27 12:42:50.001416+0800 SBFitness[15254:6944906] [general] Error loading /var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework (136): dlopen(/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/MediaPipeUnity.framework/MediaPipeUnity
Referenced from: /private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework
Reason: tried: '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/preboot/Cryptexes/OS@rpath/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/System/Library/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache)
2023-03-27 12:42:50.027051+0800 SBFitness[15254:6944906] [general] Error loading /var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework (136): dlopen(/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/MediaPipeUnity.framework/MediaPipeUnity
Referenced from: /private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/UnityFramework.framework/UnityFramework
Reason: tried: '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/preboot/Cryptexes/OS@rpath/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/private/var/containers/Bundle/Application/EEE3A682-43D0-4096-9004-F1EC9C1C4D9F/SBFitness.app/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2), '/System/Library/Frameworks/MediaPipeUnity.framework/MediaPipeUnity' (errno=2, not in dyld cache)

@spvn
Copy link
Author

spvn commented Mar 27, 2023

Realised that the plugin needs to be rebuilt for iOS because the package name matters for iOS building unlike Android... Will be trying that first

@spvn spvn closed this as completed Mar 27, 2023
@spvn
Copy link
Author

spvn commented Mar 27, 2023

I rebuilt everything and am still getting the same errors... I'll leave this issue open for now while I continue investigating.

@spvn spvn reopened this Mar 27, 2023
@homuler
Copy link
Owner

homuler commented Mar 27, 2023

It seems that PackageExporter has a bug and the MediaPipeUnity.framework.meta file is not exported (because MediaPipeUnity.framework is a directory).

As a workaround, please try checking Add To Embedded Binaries and OpenGLES.

AddToEmbeddedBinaries: true
CPU: AnyCPU
CompileFlags:
FrameworkDependencies: OpenGLES;

See also #602 (comment).

@spvn
Copy link
Author

spvn commented Mar 28, 2023

@homuler In the Installation guide when building for iOS there's this step:

(For iOS) Open mediapipe_api/objc/BUILD and modify bundle_id.

What is that bundle_id supposed to represent? I changed it to be the exact same as my main app but I'm getting this error now in XCode when trying to build to device:

Unable to install "APP_NAME"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653008
User Info: {
DVTErrorCreationDateKey = "2023-03-28 04:17:36 +0000";
IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}

This application or a bundle it contains has the same bundle identifier as this application or another bundle that it contains. Bundle identifiers must be unique.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653008

Am I supposed to just have a unique bundle id just for the mediapipe framework embedded within my app?

@spvn
Copy link
Author

spvn commented Mar 28, 2023

It seems that PackageExporter has a bug and the MediaPipeUnity.framework.meta file is not exported (because MediaPipeUnity.framework is a directory).

As a workaround, please try checking Add To Embedded Binaries and OpenGLES.

AddToEmbeddedBinaries: true
CPU: AnyCPU
CompileFlags:
FrameworkDependencies: OpenGLES;

See also #602 (comment).

Glad to say that after following these instructions and using the pre-built plugins provided in the unity package I'm now successfully running my app on iOS. Thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support Support issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants