I'm trying to query a view using TouchDB. I used the binding between TouchDB and MonoTouch available here : https://github.com/mono/monotouch-bindings/tree/master/Couchbase
When the emit
delegate method is called, I get a "System.Runtime.InteropServices.MarshalDirectiveException" saying "The type MonoTouch.Foundation.NSObject which is passed to unmanaged code must have a StructLayout attribute."
I found this bug report here : https://bugzilla.xamarin.com/show_bug.cgi?id=4781 that is similar to my problem but there isn't any updates since July 27, 2012.
Here's my test code :
CouchTouchDBServer server = new CouchTouchDBServer ();
CouchDatabase database = server.GetDatabase ("grocery-sync");
database.TracksChanges = true;
// Create a test view
design = database.DesignDocumentWithName ("grocery");
design.DefineView ("testView", (doc,emit) => {
emit (doc, doc); // Crashes here
}, "1.0");
// Query the view
CouchQuery query = design.CereateQuery("testView");
RestOperation op = query.Start();
string response = op.ResponseBody.AsString;
Console.WriteLine(response);
Has anyone successfully queried a view on TouchDB with MonoTouch? Thanks for your help