I want to use OpenFeint in a MonoTouch project. I have no experience in creating the proper bindings to use a third party Objective-C library with Mono. Reading this article on the Xamarin website did not really help me any further. Has anyone created the bindings necessary to use OpenFeint with MonoTouch or has anyone experience with creating the bindings I need?
相关问题
- System.IO.MemoryMappedFiles on MonoTouch?
- Is it possible to use NSUbiquitousKeyValueStore wi
- Monotouch PInvoke System.EntryPointNotFoundExcepti
- MonoTouch.Dialog: Dismissing a Keyboard
- Gradient as a Buttons BorderColor?
相关文章
- How to use native C++ libraries in Mono for Androi
- UTF-16 safe substring in C# .NET
- How to programmatically select a row in UITableVie
- Get control's dimensions in CustomRenderer (Xa
- Streaming audio from microphone in iPhone using Xa
- example of parsing a receipt for an in-app purchas
- What does it mean if the garbage collector is “mor
- How to I bind to the iOS Foundations function NSLo
In addition to @Jonathan excellent answers...
There are several bindings projects available on github, e.g. from Xamarin, that can give you hints if you're unsure how to convert some Objective-C constructs into C#. Real examples are often very helpful along the theory.
If you ever get blocked in a particular place then do not hesitate to ask specific questions, either here or on the mailing-list.
It is really easy.
File->New Project->MonoTouch->MonoTouch Binding project
First thing add the Objective-C library (*.a file), it's Build option should automatically say
Native Library
.Add all the header files they provide with a Build option of
None
(this is just for reference to help you write the binding).Read through the header files and start writing the binding in the ApiDefinitions.cs file:
[BaseType(typeof(NSObject))]
unless their class inherits from something else[Export("yourMethod:")]
on methods[Static]
on your end to indicate that[Model]
, otherwise it will come out as a sealed class#define MyConstant 1
- constants like these should go in the class who's header file they're in. Define a new *.cs file with the class as partial. You can also put extra C# code on the class if you wishIn general, it is a good idea to just do it yourself so you are comfortable binding Obj-C libraries like a boss. That is what I would tell a new hire in my department.