xamarin.ios - How to Expose Objective-C Pointer Method WithResultBuffer in IOS Binding -
i'm trying invoke objective-c method
-(nabto_status_t)nabtorpcinvoke:(nsstring *)url withresultbuffer:(char **)jsonresponse;
i used objective-sharpie tool generate follow method
[export("nabtorpcinvoke:withresultbuffer:")] unsafe nabto_status_t rpcinvoke(string url, ref byte jsonresponse);
please expose me correctly can jsonresponse string can use in ios app.
i made these changes generated method
[export("nabtorpcinvoke:withresultbuffer:")] unsafe nabto_status_t rpcinvoke(string url, ref intptr jsonresponse);
and got jsonresonse follow.
intptr buff=new intptr() ; status = client.rpcinvoke(url, ref buff); byte[] newarray = new byte[buff.toint32() + 1]; (int m = 0; m < buff.toint32(); m++) { byte b = marshal.readbyte(buff,m); newarray[m] = b; } var jsonresponse = system.text.encoding.utf8.getstring(newarray);
Comments
Post a Comment