MonoTouch: ESSession for external accessories
-
20-06-2021 - |
Pergunta
I am porting coding from Objective C to MonoTouch to use an external accessory. It is super basic coding, however when I create The EASession and try to use the InputStream or OutputStream, they are both NULL. I have used it in Objective-C so I know this should not happen.
I am able to repeatedly connect/disconnect the device and detect it. Now I just can't seem to read the data from the device because of this null issue. Below is my coding:
session = new EASession(acc, "com.idtechproducts.reader");
session.OutputStream.Delegate = streamDel; // Crashed saying OutputStream is null
session.OutputStream.Schedule (NSRunLoop.Current , "NSDefaultRunLoopMode");
session.OutputStream.Open ();
Solução
You need to list the external accessories you're going to use in your Info.plist.
There is some documentation on this on apple's site: http://developer.apple.com/library/ios/#featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009502
Here is a screenshot of how to set this value in Info.plist: http://screencast.com/t/AYmOWjf8wkL