【问题标题】:Integrate Adobe Omniture in Unity iOS在 Unity iOS 中集成 Adob​​e Omniture
【发布时间】:2014-09-30 14:22:19
【问题描述】:

我必须将 Adob​​e Omniture 集成到我的 Unity 项目中。我设法用 Android 调用了我需要的大部分功能,但现在出现了问题的 iOS 部分。

Omniture 附带一个必须是库本身的 *.a 文件 (AdobeMobileLibrary.a)、一个头文件 (AdobeMobile.h) 和一个用于配置的 json 文件。该库是用 Objective C 编写的。 我将所有这些文件放在 Assets/Plugins/iOS 中。

从名为 version() 的库中调用一个函数,该函数返回一个字符串

[DllImport("__Internal")]
extern static string version();

它在 Objective C 中的签名是

NSString *libraryVersion = [ADBMobile version];

Unity 可以很好地编译,但在 Xcode 中,Apple-Mach-O-Linker 说没有名为 _version() 的函数。 我检查了头文件、.a 文件和 .json 文件是否在为我创建的项目统一中。我还尝试将 .a 文件添加到 Buildphase -> Link Binary With Libraries 但没有任何帮助。

甚至可以在 C# 脚本中调用纯 Objective C 函数,还是我必须编写自己的用 c 编写的库,其中包含一些调用实际 Omniture 函数的包装函数?

【问题讨论】:

    标签: ios unity3d adobe adobe-analytics


    【解决方案1】:

    试试这个:

    当您第一次将“AdobeMobile”文件夹添加(拖动)到您的 Xcode 项目中时,请确认以下设置:

    • 选中“将项目复制到目标组的文件夹(如果需要)”项。
    • 选择单选选项“为任何添加的文件夹创建组”。
    • 选择要在其中使用 Adob​​e AppMeasurement 代码的目标(您的 Unity 应用程序)。

    在项目目标的 Build Phases 选项卡中,展开 Link Binary with Libraries 部分并添加以下库:

    • libsqlite3.dylib
    • SystemConfiguration.framework

    另外,我发现了这篇文章,它似乎澄清了你可以从 Unity 调用 Objective C 函数:Passing complex data type from a pure c plugin to Unity C# scripts:

    基本功能已经可以使用。也就是说,我已经有一个非常 我的插件中的基本函数调用以开始向 可以从 Unity 调用的 Apple App Store。在统一脚本中 你只需像这样调用这个方法:

    [DllImport ("__Internal")]
    private static extern void RequestProducts(string[] productIdentifiers, int arrayCount);                          
    
    public static void RequestProductData( string[] productIdentifiers )
    {
        RequestProducts(productIdentifiers, productIdentifiers.Length);
    }
    

    这会调用如下所示的 C 函数:

    void RequestProducts(char* productIdentifiers[], int arrayCount)
    {
        // Call the In-App purchase manager to initialize the product request
        [[InAppPurchaseManager sharedInAppPurchaseManager] RequestProductData:productIdentifierCollection];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-26
      • 2016-12-25
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 2015-11-05
      相关资源
      最近更新 更多