Forum General

Porting Xamarin C# code to Objective C

nishanthgrisconnishanthgriscon INMember
edited September 2013 in General


Has anyone tried porting Xamarin C# code to Objective C? Need to convert an existing Xamarin iOS project code to Obj C code; is there an easier (or optimal) way of doing it?

Please inform.

Thanks much!


  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Now that's an interesting question!

    The first question from a Xamarin developer is - why do you need to port to Objective C?

  • RandallToRandallTo USMember, University

    I don't know. I know there are tools out there that can take a high res color photo and make it look really old.
    Have you tried Googling "Going Backwards" or "Regressive Coding".

  • @nishanthgriscon please do enlighten us as to why do you need to port to Objective C. That will certainly help the community a lot.

  • aaoaao USMember

    I am curious to know the answer to the original question too. As for the why - that is simple , the final product at least on MacOS is extremely unstable , it crashes after several hours being up , to make the matter worse the crash dump is not usable whatsoever , it usually shows the error somewhere in the mono stack.

  • @aao interesting... how long have you been developing on MonoTouch?

  • aaoaao USMember

    Firstly it is MacOS . Secondary here is the full story:
    In May I developed a relatively small utility application for Windows using c#, it is simplified WEB service consumer. It is a free utility for my friends I hope to make commercial one day. Unfortunately most of my friend who volunteer to test it for me are Macintosh users as well as iOS users (iPhone, iPad). So I used xamarin to port it to Mac, the initial development was incredibly easy , all I had to do is to learn some objective C and apply that knowledge to monomac. In less then 1.5 month I had native looking app for MacOS. I was hoping to make it iOS product asap . But then my users start reporting crashes , many crashes are specific to clicking in a wrong place of the UI, many crashes related to application becoming unresponsive. I do not claim I write the perfect code , but there is absolutely nothing I can do to troubleshoot the problems. Crash dumps involving native-to-cocoa-to-mono stacks are useless and non-informative. So I spent 1.5 months learning/porting the app and 1.5 months troubleshooting with little success. I am an experienced developer , so sometimes I get lucky guessing the problem, like I deduced the dysfunctional cookie handling in HttpWebRequest version 2.10 and I replaced it with http headers only to discover that headers no longer work in 4.x, while cookies are only partially fixed , versioned cookie still does not work. Any developer can imagine the level of frustration I experienced on that bug alone, finding a solution for a framework bug and loosing it to irreversible forced upgrade of said framework. On that bug am at the point where I have to reimplement Http request handling using plain sockets, if I am to do that going directly to Objective C might be an easier solution. Then there is issue of native UI , where I am a total noob . The big part of the attraction of xamarin is that I can deliver native (ish) looking application in a record time, but if that UI is unstable the looks of it are irrelevant.
    So while I am impressed with team xamarin effort I cannot use it for my project and therefore I am looking for an alternative solution until such time xamarin solution is mature enough.

  • Thanks for sharing your experience. There are a lot of posts on SO which list all the different advantages of MT. But then most of them tend to be from people who are ultimately linked to the MT in one way or another. That makes it hard to gain insights like you've provided.

  • Hey people!

    Sorry for a late response. "why do I need to reverse engineer and convert the code to Obj C?" - Some of my developers friends (mere mortals) still code in Obj C. Need to handover project code (developed in Xamarin using C#) to them for further development & maintenance.

    Thanks for the fascinating responses.

Sign In or Register to comment.