0

我正在尝试构建我的简单应用程序以在 iPad 上运行。我的应用程序正在尝试从板载 pastebin 中读取数据,该应用程序通过第二个应用程序向其发送了一些数据。

但是,在 xcode 上构建应用程序时,出现以下链接器错误:

架构 armv7 的未定义符号:“_ importString”,引用自:RegisterMonoModules.o 中的 RegisterMonoModules() “ _exportString”,引用自:RegisterMonoModules.o 中的 RegisterMonoModules() ld:未找到架构 armv7 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

现在我知道它正在查看我的导入和导出字符串,但没有任何东西以双下划线开头。看看我在 XCode 中编写的 dll 文件:

#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 的以下文件夹结构中:

资产 -> 插件 -> iOS

但是我不知道如何解决我的错误。有人可以帮忙吗?

更新

根据下面的建议,我已经从导入字符串和导出字符串中省略了下划线,但我仍然遇到同样的问题。

4

0 回答 0