Visual Studio xamarin形式的iOS入口点无法通过模拟器找到,但无法通过iPhone获得 [英] Visual Studio xamarin forms iOS entrypointnotfound with simulator but not iphone

查看:92
本文介绍了Visual Studio xamarin形式的iOS入口点无法通过模拟器找到,但无法通过iPhone获得的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Visual Studio Xamarin Forms iOS项目中,我链接到使用Visual Studio Cross C ++平台构建和部署的本机(c ++)库.我可以链接并在实际设备上运行(通过Mac Server),但无法通过模拟器运行它.如果我使用相同的链接设置进行构建,则构建将失败,无法找到入口点.如果我选择不链接,那么构建会成功,但是在尝试调用本机代码的位置运行时会收到Entrypointnotfoundexception.

In my Visual Studio Xamarin Forms iOS project, I am linking against a native (c++) library I built and deployed using Visual Studio Cross C++ Platform. I can link and run against an actual device (through the Mac Server), but I cannot get it to work through the simulator. If I build with the same link settings, the build fails, not being able to find the entrypoint. If I choose not to link, then the build succeeds but I get am Entrypointnotfoundexception when running at the point where I try to call into the native code.

推荐答案

我刚刚介绍了示例从您的评论中,使用他的示例代码此处.我必须做一些事情才能使其正常运行.我的问题出在Xamarin.iOS上,但是假设您已经有特定于平台的集成工作,那么相同的步骤也可以应用于Xamarin.Forms.

I just went through the example from your comment, using his sample code here. I had to do a couple things to get it to run correctly. My problem was on Xamarin.iOS, but the same steps can be applied for Xamarin.Forms, assuming you already have platform-specific integration working.

由于代码已在物理设备上运行,因此您的.a库应该已经有一个Native Static Reference.但是iOS模拟器运行在x86_64架构上(iOS 11和更高版本

Since you have the code working on a physical device, you should already have a Native Static Reference to your .a library. But the iOS simulator runs on the x86_64 architecture (iOS 11 and later does not support i386), while your device likely runs on some version/variant of ARM. It sounds like your library is built to support only your device's architecture. You can check this by running lipo from your Mac:

% lipo -info /usr/lib/libCLib.iOS.a

也要支持sim卡的体系结构(请参见本文) ,将C ++项目构建为您需要支持的体系结构,然后将它们组合起来,如下所示:

To support the sim's architecture as well (see this article), build the C++ project to the architectures you need to support, then combine them, like so:

lipo -create -output libCLib.iOS.a libCLib.iOS-x8664.a libCLib.iOS-arm64.a

在Visual Studio中使用该输出.a文件作为新的Native Static Reference文件.在项目设置中将Supported Architectures更改为x86_64,这应该就是一切.希望这对某人有帮助.

Use that output .a file as your new Native Static Reference file back in Visual Studio. Change Supported Architectures in your project settings to x86_64, and that should be everything. Hope this helps somebody.

这篇关于Visual Studio xamarin形式的iOS入口点无法通过模拟器找到,但无法通过iPhone获得的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆