1

我让我的 HockeyApp 用户使用他们的电子邮件地址进行身份验证,如HockeyApp 文档中所述

如何从应用程序中获取用户的电子邮件(或 ID 或姓名)?

有些属性似乎包含这些值,但它们似乎是只写的,并且总是返回为nil:(文档

[BITHockeyManager sharedHockeyManager].userEmail
[BITHockeyManager sharedHockeyManager].userName
[BITHockeyManager sharedHockeyManager].userID

标题文档说“另见”此方法

 [BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:]

但我找不到从哪里获得 type 的对象BITHockeyBaseManager

4

1 回答 1

3

您在上面提到的属性以及其中的委托方法BITHockeyManagerDelegate用于丰富崩溃报告和反馈消息,其中包含有关您的用户的其他元数据。

身份验证过程中使用的电子邮件地址被安全地保存到 iOS 钥匙串中,应用程序开发人员通常不容易访问。
我的立场是正确的:实际上,有一个用于此目的的公共 API [[BITHockeyManager sharedManager].authenticator publicInstallationIdentifier],. 另请查看文档或实际代码

在应用程序的任何位置获取用户电子邮件的示例:

NSString *email = BITHockeyManager.sharedHockeyManager.authenticator.publicInstallationIdentifier;

请注意,这将根据您设置身份验证器的方式返回用户电子邮件( )kBITAuthenticatorUserEmailKeyID 代码( )。kBITAuthenticatorIdentifierKey要设置使用电子邮件身份验证,我使用了BITAuthenticatorIdentificationTypeHockeyAppEmail. 这是我的 AppDelegate 中的 HockeyApp 代码:

[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"<#App id#>" delegate:self];
[[BITHockeyManager sharedHockeyManager].authenticator setAuthenticationSecret:@"<#App Secret#>"];
[[BITHockeyManager sharedHockeyManager].authenticator setIdentificationType:BITAuthenticatorIdentificationTypeHockeyAppEmail];
[[BITHockeyManager sharedHockeyManager] startManager];
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation];
于 2016-04-11T18:42:02.713 回答