Actually, I'm a Unity developer and I know nothing about XCode and Objective C. But I have to use ObjC library for some integration and call this function from Unity. So I import that library to created XCode project and write some wrapper code between Unity and XCode. When I try to call empty function, it works for me. But when i try to write ObjC method in C file it causes linker error and I have no idea what's wrong with it. So, here's the deal:
In Unity MonoBehaviour.cs:
[DllImport("__Internal")]
public static extern void startWithAPIKey(string apiKey);
...
startWithAPIKey(apiKey);
In XCode Wrapper.h:
@interface IOSYandexMetricaWrapper : NSObject
@end
In XCode Wrapper.m:
#import "YandexMobileMetrica.h" //library header
#import "IOSYandexMetricaWrapper.h"
void startWithAPIKey(char *apiKey) {
//method that i want to call
[YMMYandexMetrica startWithAPIKey:(NSString *)apiKey];
}
So it compiles, but linker says something like this: Undefined symbols for architecture armv7: "_OBJC_CLASS_$_YMMYandexMetrica", referenced from: objc-class-ref in IOSYandexMetricaWrapper.o
Someone can help me with my problem?
Aucun commentaire:
Enregistrer un commentaire