是否可以将 xamarin 部分嵌入到现有的本机应用程序中? [英] Is it possible to embed xamarin part into an existing native app?

查看:43
本文介绍了是否可以将 xamarin 部分嵌入到现有的本机应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有现有的 iOS 和 Android 原生应用.是否可以使用 Xamarin 编码部分扩展应用程序?

I have existing iOS and Android native apps. Is it possible to extend the apps with Xamarin coded part ?

推荐答案

Xamarin.iOS 和 Xamarin.Android 目前都设置为控制你的应用程序,因此你需要让你的主程序用 C# 编写,然后调用进入现有代码.

Both Xamarin.iOS and Xamarin.Android are currently setup to take control of your application, so you need to make your main program be written in C# and then call into the existing code.

执行此操作的方法是将现有的 Objective-C 或 Java 代码绑定为 C# 库,然后从 C# 使用这些库.绑定技术正是驱动 Xamarin.iOS 和 Xamarin.Android 工具的驱动力,因此您可以有效地执行相同的操作.

The way that you would do this is to bind your existing Objective-C or Java code as C# libraries, and then consume those libraries from C#. The binding technology is precisely what drives both the Xamarin.iOS and Xamarin.Android tools, so you would effectively be doing the same.

一旦有了绑定,互操作性就可以双向发挥作用:您可以调用本机代码,而本机代码可以调用 C#.

Once you have bindings, the interoperability works both ways: you can call native code, and native code can call C#.

坏消息是,与其从零开始就开始享受使用这两种工具编写代码的乐趣,不如先做绑定,这通常不像在屏幕上观看彩色方块移动那么有趣.

The bad news is that instead of starting to enjoy writing code with both tools from day zero, the first thing you have to do the bindings, which is in general, not as fun as watching colored squared move on your screen.

这篇关于是否可以将 xamarin 部分嵌入到现有的本机应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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