-
-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathAppDelegate.cs
More file actions
57 lines (48 loc) · 2.53 KB
/
AppDelegate.cs
File metadata and controls
57 lines (48 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Diagnostics;
namespace Sentry.Samples.MacCatalyst;
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching(UIApplication application, NSDictionary? launchOptions)
{
// Override point for customization after application launch.
// Init the Sentry SDK
SentrySdk.Init(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// You must specify a DSN. On mobile platforms, this should be done in code here.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#else
// To make things easier for the SDK maintainers our samples check for a SENTRY_DSN environment variable
// and write this (as a constant) into an EnvironmentVariables class. Generally, you won't want to do
// this in your own mobile projects though - you should set the DSN in code as above
options.Dsn = EnvironmentVariables.Dsn;
#endif
options.Debug = true;
// If your app doesn't have sensitive data, you can get screenshots on error events automatically
// https://docs.sentry.io/platforms/apple/guides/mac-catalyst/configuration/options/#attach-screenshot
options.Native.AttachScreenshot = true;
});
// Try out the Sentry SDK
SentrySdk.CaptureMessage("From Mac Catalyst");
// Uncomment to try these
// throw new Exception("Test Unhandled Managed Exception");
// SentrySdk.CauseCrash(CrashType.Native);
return true;
}
public override UISceneConfiguration GetConfiguration(UIApplication application,
UISceneSession connectingSceneSession, UISceneConnectionOptions options)
{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
// "Default Configuration" is defined in the Info.plist's 'UISceneConfigurationName' key.
return new UISceneConfiguration("Default Configuration", connectingSceneSession.Role);
}
public override void DidDiscardSceneSessions(UIApplication application, NSSet<UISceneSession> sceneSessions)
{
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after 'FinishedLaunching'.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}