Hi I am trying to figure out a problem I am having with calling a simple Objective-C method from Unity iPhone Advanced.
My simple test case before getting into anything too complex was to pass a string to my ObjC method, log that string and then return another string to Unity via UnitySendMessage. Depending on what I tried I was getting this error.
matchPoint(674,0x3e2fe7c8) malloc: *** error for object 0xbab500: pointer being freed was not allocated
To simplify things I built a new project, implemented the same C# code and ObjC method code and it works as expected. So back to my real project and I can’t seem to shake this error.
In fact I commented out all the code in the method and I still get the error, even after doing a Build/Run from Unity and Build Clean from Xcode.
I am looking for any suggestions on how to debug this issue.
strings sent to the objc side must first be converted to nsstring
strings send back must go through the cocoaToMonoString (I think thats the exact naming) function to make them appropriate strings for anything.
the only place you can use NSStrings is for NSUserDefaults ↔ PlayerPrefs
the “path to c” looks right (its no objc you have there, but really c that calls objc)
can’t comment on the opposite direction though as I haven’t used that path yet, but I know that OpenFeint uses it in their unity package so that might potentially be a starting point.
There is a Plugin Tutorial from Unity (somewhat hard to find weithin the docs. Something with bonjour) have a look at that. Their Xcode Part is a Little different than Yours
I had hard time finding informations about callback from ObjectiveC code. That thread helped me out, but I wrote another thread with the problem I encountered, hope it could help someone.
Realy epic! I had the same problem and exact same dummy error! Thank you for posting this! You’ve made my day! By the way, I don’t know why - but at Xcode8 build worked just fine:eyes:…