Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Report uncaught exceptions with sentry.io #740

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# You can get the sentry auth token from https://subconscious.sentry.io/settings/developer-settings/swift-upload-026c5c/
export SENTRY_AUTH_TOKEN=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ DerivedData/

## Gcc Patch
/*.gcno
.env
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Install [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12), clone th

Common application config is set in `xcode/Subconscious/Shared/Config.swift`, set `debug` to `true` for local development.

There are also a few configurations in a `.env` file. You can use `.env.example` as a guide for how to build yours.

## Running on Device

- Enable Developer Mode on the target device
Expand Down
9 changes: 9 additions & 0 deletions xcode/Subconscious/Shared/SubconsciousApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
//

import SwiftUI
import Sentry

@main
struct SubconsciousApp: App {
init() {
SentrySDK.start { options in
// per https://docs.sentry.io/product/sentry-basics/dsn-explainer/#dsn-utilization this is fine to be public, unless it's abused (e.g. someone sending us /extra/ errors.
options.dsn = "https://72ea1a54aeb04f60880d75fcffe705ed@o4505393671569408.ingest.sentry.io/4505393756438528"
}
}

var body: some Scene {
WindowGroup {
AppView()
}
}

}
40 changes: 40 additions & 0 deletions xcode/Subconscious/Subconscious.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
8804D2552A4242E300D45E83 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 8804D2542A4242E300D45E83 /* Sentry */; };
B508956E29E7862A0048106B /* Tests_AddressBookService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B508956D29E7862A0048106B /* Tests_AddressBookService.swift */; };
B508957029E79BE70048106B /* UserProfileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B508956F29E79BE70048106B /* UserProfileService.swift */; };
B508957129E79BE70048106B /* UserProfileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B508956F29E79BE70048106B /* UserProfileService.swift */; };
Expand Down Expand Up @@ -752,6 +753,7 @@
B8E1BB79296DECE700B86E0E /* SwiftNoosphere in Frameworks */,
B82C3A7126F6B1C000833CC8 /* OrderedCollections in Frameworks */,
B822F18B27C9615600943C6B /* ObservableStore in Frameworks */,
8804D2552A4242E300D45E83 /* Sentry in Frameworks */,
B8579B6527C561E900D8B4BC /* SwiftSubsurface in Frameworks */,
B82C3A6F26F6B1C000833CC8 /* Collections in Frameworks */,
B57D63C029B574C3008BBB62 /* CodeScanner in Frameworks */,
Expand Down Expand Up @@ -1362,6 +1364,7 @@
B8EB29F726F27797006E97C3 /* Sources */,
B8EB29F826F27797006E97C3 /* Frameworks */,
B8EB29F926F27797006E97C3 /* Resources */,
8804D2562A424FD900D45E83 /* Run Script */,
);
buildRules = (
);
Expand All @@ -1379,6 +1382,7 @@
B8CA8F19288F038C005F8802 /* Tracery */,
B8E1BB78296DECE700B86E0E /* SwiftNoosphere */,
B57D63BF29B574C3008BBB62 /* CodeScanner */,
8804D2542A4242E300D45E83 /* Sentry */,
);
productName = "Subconscious (iOS)";
productReference = B8EB29FB26F27797006E97C3 /* Subconscious.app */;
Expand Down Expand Up @@ -1483,6 +1487,7 @@
B8CA8F18288F038C005F8802 /* XCRemoteSwiftPackageReference "Tracery" */,
B8E1BB77296DECE700B86E0E /* XCRemoteSwiftPackageReference "noosphere" */,
B57D63BE29B574C3008BBB62 /* XCRemoteSwiftPackageReference "CodeScanner" */,
8804D2532A4242E300D45E83 /* XCRemoteSwiftPackageReference "sentry-cocoa" */,
);
productRefGroup = B8EB29FC26F27797006E97C3 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1562,6 +1567,28 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
8804D2562A424FD900D45E83 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
bfollington marked this conversation as resolved.
Show resolved Hide resolved
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which sentry-cli >/dev/null; then\n export SENTRY_ORG=subconscious\n export SENTRY_PROJECT=apple-ios\n if [ \"$SENTRY_AUTH_TOKEN\" -eq \"\" ]; then\n echo \"error: sentry auth token isn't set. Cannot upload debug symbols.\"\n exit 1\n else\n ERROR=$(sentry-cli debug-files upload \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\n fi\nelse\n echo \"warning: sentry-cli not installed. download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
B80057E427DC355E002C0129 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -2471,6 +2498,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
8804D2532A4242E300D45E83 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/getsentry/sentry-cocoa.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 8.0.0;
};
};
B57D63BE29B574C3008BBB62 /* XCRemoteSwiftPackageReference "CodeScanner" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/twostraws/CodeScanner";
Expand Down Expand Up @@ -2522,6 +2557,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
8804D2542A4242E300D45E83 /* Sentry */ = {
isa = XCSwiftPackageProductDependency;
package = 8804D2532A4242E300D45E83 /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = Sentry;
};
B57D63BF29B574C3008BBB62 /* CodeScanner */ = {
isa = XCSwiftPackageProductDependency;
package = B57D63BE29B574C3008BBB62 /* XCRemoteSwiftPackageReference "CodeScanner" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
"version" : "0.3.0"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa.git",
"state" : {
"revision" : "d277532e1c8af813981ba01f591b15bbdd735615",
"version" : "8.8.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
Expand Down