简体   繁体   English

如何将NSData转换为FREByteArray

[英]How to convert NSData to FREByteArray

I am working on a simple AIR native extension for iOS which is using external accessory to read the data from SmartCard and transfer it to AIR application. 我正在为iOS开发一个简单的AIR本机扩展,它使用外部附件从SmartCard读取数据并将其传输到AIR应用程序。 I have managed to transfer the fields returned as NSString succesfully, but I'm struggling to get the photo (returned as NSData). 我已经成功地成功转移了返回为NSString的字段,但是我正在努力获取照片(返回为NSData)。 I'm not an iOS or Obj-C pro (in fact it's my first contact with them). 我不是iOS或Obj-C专业人士(实际上,这是我第一次与他们联系)。 I've searched numerous threads and sites, but couldn't find the solution to my problem. 我搜索了许多线程和站点,但是找不到解决我问题的方法。

The program is working in such a way: 该程序的工作方式如下:
- user presses the button in the flex app -用户在flex应用中按下按钮
- the app calls the ANE method -应用程序调用ANE方法
- the ANE reads the data from the smartcard in NSData format (up to this point it's ok) -ANE以NSData格式从智能卡中读取数据(到目前为止,可以)
- i need to package the nsdata object into FREByteArray and send it back to flex app (how to do it?) -我需要将nsdata对象打包到FREByteArray中,然后将其发送回flex应用程序(该怎么做?)

Anyone could help in this field? 任何人都可以在这个领域提供帮助吗? Thanks 谢谢

Ok, it seems I have found the solution. 好的,看来我找到了解决方案。 It was necessary to provide empty byte array from the ActionScript side of the application to the native extension, and then just fill it in the ANE with data. 必须从应用程序的ActionScript端到本机扩展提供一个空字节数组,然后将其填充到ANE中。 Looks weird, but works :) 看起来很奇怪,但是有效:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM