Kinvey Xamarin:如何从用户实例接收数据?

Kinvey Xamarin:如何从用户实例接收数据?,xamarin,kinvey,Xamarin,Kinvey,我现在正在从事一个Kinvey项目,在从用户实例读取用户名或特殊属性时遇到一些问题。我第一次尝试使用相同的方法获取\u User.ID,方法是调用\u User.UserName,但这并没有返回任何内容(但奇怪的是,ID确实返回了)。我也在谷歌上搜索过,但没有任何关于它的文章。希望您能帮忙,将不胜感激 对于特殊属性,请使用用户类上的属性数组。 像这样的代码: Console.WriteLine ("custom attribute is: " + kinveyClient.User ().Att

我现在正在从事一个Kinvey项目,在从用户实例读取用户名或特殊属性时遇到一些问题。我第一次尝试使用相同的方法获取
\u User.ID
,方法是调用
\u User.UserName
,但这并没有返回任何内容(但奇怪的是,ID确实返回了)。我也在谷歌上搜索过,但没有任何关于它的文章。希望您能帮忙,将不胜感激

对于特殊属性,请使用
用户
类上的
属性
数组。 像这样的代码:

Console.WriteLine ("custom attribute is: " + kinveyClient.User ().Attributes["myAttribute"]);
对于用户名,请尝试
.username()
,但似乎必须在填充此字段之前显式检索用户对象

User retrieved;
try {
    retrieved = await kinveyClient.User().RetrieveAsync();
} catch (Exception e) {
    Console.WriteLine("{0} caught exception: ", e);
    retrieved = null;
}
Console.WriteLine ("logged in as: " + retrieved.Username );
Console.WriteLine ("custom attribute is: " + retrieved.Attributes["myAttribute"]);
文件:

(答案适用于SDK版本1.6.11)