1

Native iOS library API: - void getCamImage(Byte[])data withWidth:(size_t)width withHeight:(size_t)height withStride:(size_t)stride ;

In the Binding DLL project, i tried the following: [Export("getCamImage:withWidth:withHeight:withStride:")] void GetCamImage(Byte[] buffer, int width, int height, int stride);

Tried byte[] instead of Byte[]. Getting the following error: error CS0452: The type 'byte' must be a reference type in order to use it as parameter 'T' in the generic type or method 'NSArray.FromNSObjects(params T[])'

Question : how to export the ByteArray parameter as?

dd1610
  • 11
  • 2
  • 1
    I think byte[] should be the right type in C# for Byte[] in Native iOS. I did not get the error when I use your c# code in my project. – nevermore May 11 '20 at 06:14
  • 1
    Hi @JackHua-MSFT I used objective sharpie to convert my FAT library (.a file) to AppDefiniftion.cs and StructsAndEnums.cs . When I try to build the binding library project to get the DLL , it is still giving me the above mentioned project. Are there any project settings required ? – dd1610 May 11 '20 at 08:04
  • You can follow [this document](https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/walkthrough?tabs=macos) to learn setting requirements. – nevermore May 11 '20 at 09:49
  • The interface in which the API is exported, has [BaseType(typeof(NSobject))]. So in the generated code , it creates a var buff = NSArray.fromNSObjects(bufer) and that is creating the issue. – dd1610 May 12 '20 at 14:10
  • byte in C# is struct and you can't pass it as an object. How about [convert byte array to object](https://stackoverflow.com/a/33022788/10539446) first. – nevermore May 13 '20 at 05:59
  • The native iOS Api takes Byte[] as parameter. how will i pass it down to the native iOS library as native library ? – dd1610 May 13 '20 at 20:03
  • Sorry, I does not get your point. You can open a free xamarin ticket [here](https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6]) for more help if needed. – nevermore May 14 '20 at 08:23

0 Answers0