Hi,
I'm very new to ios/objective-c development and am trying to build an ios plugin that adds things to the screen when triggered by unity. I'm having a strange issue when trying to access the view controller. When I call UnityGetGLViewController() from method2, everything builds and is peachy. But when called from method1, which is linked to the cs file in Unity, I get this linker error:
Undefined symbols for architecture armv7:
"_UnityGetGLViewController", referenced from:
_method1 in TestClass.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my code, stripped down for ease of reading:
//TestClass.m
#import "TestClass.h"
extern UIViewController *UnityGetGLViewController();
@implementation TestClass
void method1(NSString* path){
UIViewController *rootView = UnityGetGLViewController();
}
void method2(NSString* path){
UIViewController *rootView = UnityGetGLViewController();
}
@end
//iosPlugin.cs
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class iosPlugin : MonoBehaviour {
[DllImport ("__Internal")]
private static extern void method1 (string path);
void Start () {
method1("string here");
}
}
Any ideas as to why this is happening?
↧