我正在使用Hockeyapp来记录我的Xamarin应用程序中的崩溃
对于Android,我使用此代码自动提交崩溃,只需要额外的信息:
内部MainActivity OnCreate方法:
CrashManager.Register(this, "APP_ID", new CustomCrashListener());
CustomCrashListener:
public class CustomCrashListener : CrashManagerListener
{
public override bool ShouldAutoUploadCrashes()
{
return true;
}
public override string UserID => "UserID recovered from settings.";
public override string Contact => "More info from settings.";
public override string Description => "Custom Description";
}
现在对于iOS我发现这是自动上传崩溃:
内部AppDelegate:
BITHockeyManager manager = BITHockeyManager.SharedHockeyManager;
manager.Configure("APP_ID");
manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
manager.StartManager();
manager.Authenticator.AuthenticateInstallation();
我的问题是,我无法在iOS中找到类似于Android的内容,通过自动发送崩溃日志发送一些额外的信息,在iOS中有什么方法可以做到这一点吗?
答案 0 :(得分:3)
在UIApplicationDelegate
课程中,添加IBITHockeyManagerDelegate
和/或IBITCrashManagerDelegate
。
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate, IBITHockeyManagerDelegate, IBITCrashManagerDelegate
BITHockeyManager.Delegate
:var hockeyManager = BITHockeyManager.SharedHockeyManager;
hockeyManager.Delegate = (HockeyApp.iOS.BITHockeyManagerDelegate)(IBITHockeyManagerDelegate)this;
// From IBITHockeyManagerDelegate
[Export("userIDForHockeyManager:componentManager:")]
public string UserIdForHockeyManager(BITHockeyManager hockeyManager, BITHockeyBaseManager componentManager)
{
return "sushihangover";
}
[Export("userNameForHockeyManager:componentManager:")]
public string UserNameForHockeyManager(BITHockeyManager hockeyManager, BITHockeyBaseManager componentManager)
{
return "Sushi Hangover";
}
[Export("userEmailForHockeyManager:componentManager:")]
public string UserEmailForHockeyManager(BITHockeyManager hockeyManager, BITHockeyBaseManager componentManager)
{
return "sushihangover@hacktheplanet.me";
}
// From IBITCrashManagerDelegate
[Export("applicationLogForCrashManager:")]
public string ApplicationLogForCrashManager(BITCrashManager crashManager)
{
return "StackOverflow rocks...";
}