Currently trying to create a wrapper for an iOS framework on Unity.
I made a .bundle, containing basic objective-c code :
sample.h :
#import <Foundation/Foundation.h>
extern "C"
{
void SampleFunction(); // this is going to call already bridged swift or objc code
}
sample.mm :
#import "Sample.h"
#import <SDK/SDKFunctions.h>
void SampleFunction()
{
// my sweet functions calls
}
The SDK is included in the bundle as a .framework (references in "Linked Frameworks and libraries"). The bundle target is iOS.
The bundle builds successfully.
The bundle is placed in Unity under "Assets/Plugins/iOS", marked as "iOS" and "Add to Embedded Binaries"
Then, in Unity, there is a simple C# script calling SDK functions :
sample.cs
public class BundleImportSample : MonoBehaviour {
#if UNITY_IOS
[DllImport("__Internal")]
private static extern void SampleFunction();
#endif
void Start()
{
#if UNITY_IOS
SampleFunction();
#endif
}
}
When I test this code in the editor I get the following error :
EntryPointNotFoundException: SampleFunction
If I build the generated project on iOS, I get a similar issue :
ld: symbol(s) not found for architecture arm64
Note : I used the following tutorial as guideline : http://blog.mousta.ch/post/140780061168
Why is SampleFunction() not found in __Internal ?
from Unity iOS - Cannot import functions from .Bundle
No comments:
Post a Comment