ShareKit with MonoTouch how?

How do you use ShareKit with MonoTouch?

The MonoTouch Bindings project on GitHub seems to be bindings for ShareKit but I can't get them to work. I currently have an iPhone app developed using MonoTouch in MonoDevelop, but I don’t know how to actually get ShareKit into my application.

I downloaded the MonoTouch Bindings project, but when I make in the ShareKit directory, it seems ShareKit itself is required. Then I downloaded ShareKit, but I'm not sure if I have to follow the installation instructions to integrate ShareKit into an Xcode project or even if I should create ShareKit at all. I tried to “create” an empty iPhone application project using ShareKit, but some parts of the instructions are not updated for the latest Xcode, it seems I'm stuck in this process. I am trying to get this working, but my experience with Xcode is so far limited to what is little needed to develop MonoTouch.

Or is there a “precompiled” ShareKit iOS binary that can be used with MonoTouch?

Can anyone verify that ShareKit can really be used with MonoTouch and go through the steps necessary for it to work?

Thanks in advance!

+7
source share
2 answers

First you downloaded from getsharekit.com or are you using ShareKit 2.0? If you are using DL from getharekit, I highly recommend you upgrade first. Secondly, some basic installation instructions for using ShareKit with MonoTouch:

Steps

1) Download the code

2) Open in Xcode, and if his application creates a new Xcode type library project iOS

3) Compile the library and pay attention to the necessary frameworks - this will help you later when linking to monotouch

3) Compile the i386 Sim version of lib and rename it to libXYZLib_Sim.a - copy this to / Lib in your project and set its build action to None. You can find this under / ProjectLib / build / Debug-iphonesimulator /

4) Compile the version of arm6 with the correct version and copy it to / Lib in your project and set its build action to None. You can find this under / ProjectLib / build / Debug-iphoneos /

5) Run NovellHeaderParser so against libraries containing .h files

@@ mono "/Users/XX/Projects/NovellHeaderParser/NovellHeaderParser/bin/Debug/NovellHeaderParser.exe" / Users / XX / Documents / ShareKitLib / ShareKit / Core @@

for this, a MonoMac.cs file must be created, which you can import into your system

6) Repeat step 5 for other directories. NOTE. You really only need to run the parser against .h files with entry points, for example. top-level classes that the API calls directly. subclasses, utilities, auxiliary methods do not need analysis.

7) Combine all MonoMac.cs files into a new MyLib.cs file and add it to the project under / Lib - set your build options to None

8) Change any links from MonoMac to MonoTouch

10) The parser can create an enum.cs file for each analyzed directory, but if you do not create your own MyLibEnum.cs with any structures or enumerations required by the API, add it to / Lib and set the build parameters to None

11) Open a terminal window and go to the / Lib directory of your project

12) run the following btouch command line - this will create a wrapper.dll file from the interfaces defined in MyLib.cs @@ / Developer / MonoTouch / usr / bin / btouch -v MyLib.cs -s MyLibEnum.cs @@

13) Add the missing enumerations or structures to MyLibEnum.cs and repeat step 12

14) Correct any multiple declarations of selectors by renaming them - this may cause a problem later (see note 1)

15) Fix any missing links, for example. NSMutableArray does not seem to exist in monotouch, so I change them to NSArrays (I think they change under monotouch anyway?)

16) Go back to 12) and repeat until a dll is created.

17) Add the link to the DLL in the project

18) Add the following to iPhone Build> additional mtouch options in SIMULATOR DEBUG / RELEASE BUILD: @@ -gcc_flags "-L $ {ProjectDir} / Lib -lMyLib_Sim -framework QuartzCore -framework CoreGraphics -framework MessageUI -framework Security -framework UIKit -framework CFNetwork -force_load $ {ProjectDir} /Lib/libMyLib_Sim.a -ObjC "@@

'' 'Notification' ''

no trailing / on -L $ {ProjectDir} / Lib

-lShareKitLib_Sim does not need the starting lib prefix or .a suffix

add one -framework for each structure used to create lib - above is not an exaustive list

19) Add the following to iPhone Build> additional mtouch options TO IPHONE DEBUG / RELEASE ARROW: @@ -gcc_flags "-L $ {ProjectDir} / Lib -lMyLib -framework QuartzCore -framework CoreGraphics -framework MessageUI -framework Security -framework UIKit -framework CFNetwork -force_load $ {ProjectDir} /Lib/libMyLib.a -ObjC "@@

20) CHECK IT!

+2
source

In most cases, when switching from bindings to MonoTouch, you need to load the bindings (or SDK) from the real library. For example, with TestFlight bindings, you need to load the SDK and put it in the same directory as the makefile. I personally have not used ShareKit, but I believe that it will work the same way (I know that most, if not all, bindings in MT bindings, the GitHub project works just like that). You do not need to deal with Xcode at all. Just download the SDK, put it in the correct directory and run the make file. This should spit DLL for reference to use with MonoTouch.

One of the limitations of using ShareKit bindings is that, as far as I know, UI settings must be done in Objective-C before trying to use the linker. If you're ok with a ready-made interface, I would go for it. Otherwise, there are many other open source libraries for creating a simple sharing dialog (and now that Twitter is built into iOS, it's even easier).

+5
source

All Articles