问题描述
我正在使用Xamarin,我想知道是否可以在共享项目中运行Parse,这样我就不必在解决方案中的iOS项目和Android项目中重复我的代码了?
I am using Xamarin and I was wondering if there is a way to run Parse in a shared project, so that I don't have to duplicate my code in the iOS project and the Android project in my solution?
我是否缺少某些内容,还是真的必须重复解析代码?
Am I missing something, or do I really have to duplicate the Parse code?
推荐答案
我所做的是创建一个共享项目类型来托管我的解析特定代码.然后在我的Xamarin.Android应用程序中,引用Parse.Android.dll.在我的Xamarin.iOS代码中,我引用了Parse.iOS.dll.请记住,共享项目" 类型不会创建DLL .在引擎盖下,它只是文件链接到您的实际项目中,因此它将使用该项目的引用.共享项目不应包含任何iOS或Android特定代码.
What I did was create a Shared Project type to host my Parse specific Code. Then in my Xamarin.Android app, I reference the Parse.Android.dll. In my Xamarin.iOS code, I referenced the Parse.iOS.dll. Remember, that the "Shared Project" type does not create a DLL. Underneath the hood it's just file linking into your actual project, so it will use the references of that project. The Shared Project should not contain any iOS or Android specific code.
这篇关于解析和Xamarin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!