2

So, I have uploaded my project file here: http://devswap.org/downloads/readerTest.zip

I did a copy/paste exercise from the iOS sample application provided by MagTek, and I now have virtually identical code. (AppDelegate, ViewController, etc...) My card reader will connect to the device with the sample app but not my custom app.

What I have tried: I have assigned the correct sdk protocol identifier, com.magtek.idynamo, as specified in the Technical Documentation: http://www.magtek.com/docs/99875473.pdf (page 14).

I know that it authenticates with my iPad mini (iOS 7.1) because the sample app functions, and the EAAccessory class registers that it is connected when my app launches. However, I am unable to connect to it using MagTek's MTSCRA class.

At this point I am sure that it has something to do with the way the project is set up, as the code is virtually identical. The only difference is that I have used a storyboard, while the sample app uses a single .xib file.

If anybody can take a look at the project file hosted on my website above and see what I'm doing wrong, any help is appreciated.

4

1 回答 1

8

您的代码看起来不错,但是您似乎在 Info.plist 中缺少正确的 External Accessory 键,如调试器窗口中的此条目所述。

2014-06-17 01:27:50.111 readerTest[3075:60b] ERROR - opening session failed as protocol com.magtek.idynamo is not declared in Info.plist

您将密钥作为字符串,它应该是一个数组。

右键单击您的 plist,选择作为源代码打开。

删除 com.magtek.idynamo 的现有条目。

将此代码粘贴到 plist 中:

<key>UISupportedExternalAccessoryProtocols</key>
<array>
    <string>com.magtek.idynamo</string>
</array>

这将解决您的问题,并且软件将正常运行。

于 2014-06-17T07:31:28.390 回答