- Home /
Unity iPhone plugin - what data type to use?
I'm integrating Countly iOS plugin with Unity. I'm following http://docs.unity3d.com/Documentation/Manual/PluginsForIOS.html and its example: http://docs.unity3d.com/Documentation/Images/manual/iPhoneNativeCodeSample.zip
I've got most of the things done - I can call start()
and 2 recordEvent()
overloads and they seem to work fine. But calling recordEvent()
with segmentation seems to break something in my application (other objects behave weirdly) and these events never show up in the Countly's Dashboard.
My guess is that I'm using incorrect type for the dictionary data in parameter. I.e. objective c's `NSString ** I change to **
const char ` (see Bonjour example) and then it translates to `string`, `int` translates to `int` but what does **`NSDictionary `* translate to? How to I receive this argument type from C# code?
Answer by SolidSnake · May 15, 2013 at 05:10 PM
The way I would do it is to translate NSDictionary to a string based format such as JSON and pass it between ObjC and C#
Exactly. NSDictionary can't be simply casted or marshalled to a C# type since it's not a primitive type like int, float or string.
See this question which is about the same thing:
http://answers.unity3d.com/questions/364779/passing-nsdictionary-from-obj-c-to-c.html
I know, that's exactly what I did (not using JSON, though). But I was curious if it was possible to translate NSDictionary *
.