Ios 在iPad上构建Unity应用程序
我正在尝试构建一个简单的应用程序,在iPad上运行。我的应用程序正在做的是尝试从板载粘贴箱读取数据,该粘贴箱通过第二个应用程序向其发送一些数据 但是,在xcode上构建应用程序时,我有以下链接器错误: 架构armv7的未定义符号:“\u importString”, 引用自: RegisterMonoModules.o“\u exportString”中的RegisterMonoModules(),引用自: 在RegisterMonoModules.o ld中找不到架构armv7的符号clang:错误:链接器命令失败,错误为 退出代码1(使用-v查看调用) 现在我知道它正在查看我的导入和导出字符串,但没有任何字符串是以双下划线开头的。看看我在XCode中编写的dll文件:Ios 在iPad上构建Unity应用程序,ios,xcode,dll,unity3d,Ios,Xcode,Dll,Unity3d,我正在尝试构建一个简单的应用程序,在iPad上运行。我的应用程序正在做的是尝试从板载粘贴箱读取数据,该粘贴箱通过第二个应用程序向其发送一些数据 但是,在xcode上构建应用程序时,我有以下链接器错误: 架构armv7的未定义符号:“\u importString”, 引用自: RegisterMonoModules.o“\u exportString”中的RegisterMonoModules(),引用自: 在RegisterMonoModules.o ld中找不到架构armv7的符号clang
#define MakeStringCopy( _x_ ) ( _x_ != NULL && [_x_ isKindOfClass:[NSString class]] ) ? strdup( [_x_ UTF8String] ) : NULL
#define GetStringParam( _x_ ) ( _x_ != NULL ) ? [NSString stringWithUTF8String:_x_] : [NSString stringWithUTF8String:""]
//send clipboard to unity
extern "C" const char * importString()
{
NSString *result = [UIPasteboard generalPasteboard].string;
return MakeStringCopy(result);
}
//get clipboard from unity
extern "C" void exportString(const char * eString)
{
[UIPasteboard generalPasteboard].string = GetStringParam(eString);//@"the text to copy";
}
还有我在Unity应用程序中的姐妹类:
[DllImport("__Internal")]
private static extern string _importString();
//retrieves the clipboard contents from xcode
public static string ImportString()
{
//Debug.Log ("import: "+_importString());
if( Application.platform == RuntimePlatform.IPhonePlayer )
{
return _importString();
}
else
{
return "";
}
}
[DllImport("__Internal")]
private static extern void _exportString(string exportData);
//passes string to xcode and xcode copies to clipboard
public static void ExportString(string exportData)
{
// Debug.Log ("export: "+exportData);
if( Application.platform == RuntimePlatform.IPhonePlayer )
{
_exportString(exportData);
}
}
我已将dll文件存储在Unity中的以下文件夹structor中:
资产->插件->iOS
但我不知道如何纠正我的错误。有人能帮忙吗
更新
根据下面的建议,我在导入字符串和导出字符串中都添加了下划线,但仍然存在相同的问题 Unity在构建iOS播放器时是否将Obj-C文件复制到Libraries文件夹?它的扩展名是.m还是.mm?是的,文件被复制了,它是一个.mm。请尝试省略前导下划线。这可能会导致与保留名称混淆,即使后面是小写字母。你看,我刚试过,但还是犯了同样的错误。