Reputation: 1522
I'm trying to follow the tutorials available on Parse.com for calling CloudFunctions from the .Net API.
Apparently, this should work:
var result = await ParseCloud.CallFunctionAsync<IDictionary<string, object>>("hello", new Dictionary<string, object>());`
When calling in Xamarin:
button.Click += async (sender, e) => {
var result = await ParseCloud.CallFunctionAsync<IDictionary<string, object>> ("hello", new Dictionary<string, object>());
};
It just locks up my mobile app. When calling:
button.Click += async (sender, e) => {
var obj = new ParseObject("Note");
obj ["text"] = "Hello, world! This is a Xamarin app using Parse!";
obj ["tags"] = new List<string> {"welcome", "xamarin", "parse"};
await obj.SaveAsync ();
};
It successfully saves an object to Parse.
When calling the 'hello' Cloud Function using curl, it works perfectly and returns 'Hello World'
I don't understand what I'm doing wrong here. Any suggestions?
Upvotes: 1
Views: 990
Reputation: 1522
var result = await ParseCloud.CallFunctionAsync<string>("hello", new Dictionary<string, object>());
Toast.MakeText(this,result.ToString(),ToastLength.Short).Show();
It was because the example on their website was wrong! It should be CallFunctionAsync<string>
, not CallFunctionAsync<IDictionary<string, object>>
as the type being returned is a string!
Arrrrhhhh. Hopefully this helps someone in the future.
EDIT: According to the developers at Parse, this should be fixed now / soon.
Upvotes: 3