Xamarin 错误 IOS Firebase AuthDataResult 不包含 ProfileChangeRequest()
Error for Xamarin IOS Firebase AuthDataResult does not Contain ProfileChangeRequest()
当我尝试更改用户名时收到一条错误消息,提示 AuthDataResult 不包含 ProfileChangeRequest()。我必须在线研究并阅读 firebase 文档,但没有运气。
public static async Task Register(UIViewController thisView,
string inpName,
string inpEmail,
string inpPassword)
{
bool done = false;
AppDataClass.auth.CreateUser(inpEmail, inpPassword, (user, error) =>
{
if (error != null)
{
AlertShow.Alert(thisView, "Error",
"This went wrong: " + error.UserInfo.Description);
return;
}
UserProfileChangeRequest changeReq = user.ProfileChangeRequest;
changeReq.DisplayName = inpName;
changeReq.CommitChanges((profileError) =>
{
if (profileError != null)
{
AlertShow.Alert(thisView, "Error",
"Profile Error: " + profileError);
return;
}
done = true;
});
});
while (!done)
{
await Task.Delay(50);
}
}
如果您阅读有关方法的文档 -signInWithEmail:password:completion:, the call back it retures is a FIRAuthDataResultCallback , the first parameter here is FIRAuthDataResult。
所以用户应该是:
user.user.ProfileChangeRequest
说清楚:
public static async Task Register(UIViewController thisView,
string inpName,
string inpEmail,
string inpPassword)
{
bool done = false;
AppDataClass.auth.CreateUser(inpEmail, inpPassword, (authDataResult, error) =>
{
if (error != null)
{
AlertShow.Alert(thisView, "Error",
"This went wrong: " + error.UserInfo.Description);
return;
}
UserProfileChangeRequest changeReq = authDataResult.user.ProfileChangeRequest;
changeReq.DisplayName = inpName;
});
while (!done)
{
await Task.Delay(50);
}
}
参考:
当我尝试更改用户名时收到一条错误消息,提示 AuthDataResult 不包含 ProfileChangeRequest()。我必须在线研究并阅读 firebase 文档,但没有运气。
public static async Task Register(UIViewController thisView,
string inpName,
string inpEmail,
string inpPassword)
{
bool done = false;
AppDataClass.auth.CreateUser(inpEmail, inpPassword, (user, error) =>
{
if (error != null)
{
AlertShow.Alert(thisView, "Error",
"This went wrong: " + error.UserInfo.Description);
return;
}
UserProfileChangeRequest changeReq = user.ProfileChangeRequest;
changeReq.DisplayName = inpName;
changeReq.CommitChanges((profileError) =>
{
if (profileError != null)
{
AlertShow.Alert(thisView, "Error",
"Profile Error: " + profileError);
return;
}
done = true;
});
});
while (!done)
{
await Task.Delay(50);
}
}
如果您阅读有关方法的文档 -signInWithEmail:password:completion:, the call back it retures is a FIRAuthDataResultCallback , the first parameter here is FIRAuthDataResult。
所以用户应该是:
user.user.ProfileChangeRequest
说清楚:
public static async Task Register(UIViewController thisView,
string inpName,
string inpEmail,
string inpPassword)
{
bool done = false;
AppDataClass.auth.CreateUser(inpEmail, inpPassword, (authDataResult, error) =>
{
if (error != null)
{
AlertShow.Alert(thisView, "Error",
"This went wrong: " + error.UserInfo.Description);
return;
}
UserProfileChangeRequest changeReq = authDataResult.user.ProfileChangeRequest;
changeReq.DisplayName = inpName;
});
while (!done)
{
await Task.Delay(50);
}
}
参考: