【问题标题】:Hello World Cloud Function with Parse and Xamarin .NET带有 Parse 和 Xamarin .NET 的 Hello World 云函数
【发布时间】:2014-08-03 23:42:18
【问题描述】:

我正在尝试按照 Parse.com 上提供的教程从 .Net API 调用 CloudFunctions。

显然,这应该有效:

var result = await ParseCloud.CallFunctionAsync<IDictionary<string, object>>("hello", new Dictionary<string, object>());`

在 Xamarin 中调用时:

button.Click += async (sender, e) => {
    var result = await ParseCloud.CallFunctionAsync<IDictionary<string, object>> ("hello", new Dictionary<string, object>());
};

它只是锁定了我的移动应用程序。调用时:

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 ();
};

它成功地将一个对象保存到 Parse。

当使用 curl 调用“hello”云函数时,它可以完美运行并返回“Hello World”

我不明白我在这里做错了什么。有什么建议吗?

【问题讨论】:

    标签: c# xamarin parse-platform


    【解决方案1】:
    var result = await ParseCloud.CallFunctionAsync<string>("hello", new Dictionary<string, object>());
                    Toast.MakeText(this,result.ToString(),ToastLength.Short).Show();
    

    那是因为他们网站上的例子是错误的!它应该是CallFunctionAsync&lt;string&gt;,而不是CallFunctionAsync&lt;IDictionary&lt;string, object&gt;&gt;,因为返回的类型是字符串!

    啊啊啊啊。希望这对将来的某人有所帮助。

    编辑:根据 Parse 的开发人员的说法,这应该现在/很快就会修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-19
      • 2020-04-15
      • 2022-01-10
      • 1970-01-01
      • 2019-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多