简体   繁体   English

如何在Xamarin(窗体)iOS项目中使用AirWatch SDK?

[英]How to use AirWatch SDK in a Xamarin (Forms) iOS Project?

AirWatch SDK allows you to include MDM features in your iOS app. AirWatch SDK允许您在iOS应用程序中包含MDM功能。 I followed the instructions from VMWare's site here . 我跟着来自VMware的网站上的说明这里

Unfortunately, after adding the NuGet package to my iOS project, the project fails to compile and throws more than 300 compilation errors of the type 不幸的是,在将NuGet程序包添加到我的iOS项目之后,该项目无法编译,并引发了300多个该类型的编译错误

MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: AWWebsiteFilteringPayload. 

The symbol '_OBJC_CLASS_$_AWWebsiteFilteringPayload' could not be found in any of the libraries or frameworks linked with your application. 在与您的应用程序链接的任何库或框架中都找不到符号“ _OBJC_CLASS _ $ _ AWWebsiteFilteringPayload”。

The reason for the compilation errors is the Platform (iPhone Simulator vs Device) for which the project is built and the Supported Architectures. 编译错误的原因是为其构建项目的平台(iPhone Simulator vs Device)和支持的体系结构。

Changing the build option to target a real device gets past the compilation errors. 将构建选项更改为以实际设备为目标可以克服编译错误。

If you scroll through the build output you will see something like this 如果滚动查看构建输出,将会看到类似以下内容

ld : warning : ignoring file /Path/To/Your/Project/MyApp.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-12.1/mtouch-cache/AWSDK.a, missing required architecture x86_64 in file /Path/To/Your/Project/MyApp.iOS/obj/iPhoneSimulator/Debug/device-builds/iphone10.4-12.1/mtouch-cache/AWSDK.a (2 slices)
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_AWWebsiteFilteringPayload", referenced from:
         -u command line option 

This Stackoverflow answer helped to discover the architectures targeted in the .a file 这个 Stackoverflow答案有助于发现.a文件中的目标体系结构

In a terminal window enter 在终端窗口中输入

lipo -info /Path/To/AWSDK.a

which returns 哪个返回

Architectures in the fat file: AWSDK.a are: armv7 arm64

Now right click on the iOS project and bring up the Options window. 现在,右键单击iOS项目并打开“选项”窗口。 Navigate to the "iOS Build" section. 导航到“ iOS Build”部分。 The Platform dropdown says "iPhone Simulator". 平台下拉菜单显示“ iPhone Simulator”。 Check the Supported architectures dropdown. 检查支持的体系结构下拉列表。 You will see i386, x86_64, i386+x86_64 which are not supported in the AWSDK.a file. 您将看到AWSDK.a文件不支持的i386,x86_64,i386 + x86_64。

Change platform to iPhone and you will see the Armxx options. 将平台更改为iPhone,您将看到Armxx选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM