Monotouch和本机iOS代码 [英] Monotouch and native iOS code

查看:73
本文介绍了Monotouch和本机iOS代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在单个应用程序中将使用monotouch编译的C#库与Objective-C前端相链接,或者该应用程序必须全部还是全部?

Is it possible to link a C# library compiled using monotouch with an objective-C front end in a single application, or does the app have to be all or nothing?

推荐答案

可能,但是您不会从MonoTouch工具中获得任何帮助,并且无法摆脱仍然必须拥有的事实Mono运行时以执行您的C#代码.

It is possible but you aren't going to get any help from the MonoTouch tooling and you can't get away from the fact that you still have to have the Mono runtime to execute your C# code.

为了将Mono运行时提供给Objective-C应用,必须将运行时嵌入到应用中. MonoTouch网站上有一些有关如何执行此操作的文档.此处,您可以找到有关将Mono嵌入到其中的更多技术细节.您的应用程序此处.

In order to provide the Mono runtime to the Objective-C app, the runtime will have to be embedded into the app. The MonoTouch site has some docs on how to do this here and you can find more technical details about embedding Mono into your application here.

MonoTouch在编译C#代码时会生成.m和.s文件,这些文件将被Objective-C用来调用该代码.这些文件将需要包含在使用中的Objective-C项目中,但是MonoTouch在使用完这些文件后会对其进行清理.为了保持mtouch,MonoTouch编译器从删除.m和.s文件时,请在调用编译器时使用--keeptemp选项.您可以在这里找到一个很好的示例Makefile ,以帮助您找出答案如何从命令行正确调用mtouch.

MonoTouch, when compiling your C# code, produces .m and .s files that are used by Objective-C to call that code. These files will need to be included in the consuming Objective-C project but MonoTouch cleans up those files after they've been used. In order to keep mtouch, the MonoTouch compiler, from deleting the .m and .s files, use the --keeptemp option when invoking the compiler. You can find a good sample Makefile here to help you figure out how to call mtouch correctly from the command line.

最后,您需要完整版的MonoTouch才能执行此操作.试用版将不会生成.s文件.

Finally, you will need the full version of MonoTouch in order to do this. The trial version will not generate the .s files.

这篇关于Monotouch和本机iOS代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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