تخطَّ إلى المحتوى

iOS (Swift)

التثبيت

في Xcode: File ← Add Package Dependencies ← https://github.com/heysada/sada-ios، ثم أضف مكتبة HeysadaAthar إلى هدف تطبيقك.

حزمة Swift واحدة تضم كل حزمنا، فلها إصدار واحد لكل المنتجات: تُحدَّث معاً. وكل مكتبة تربط الملف الثنائي نفسه HeysadaKit، فـالتطبيق يحمل شيفرة كل المنتجات أياً كانت المكتبات التي يستعملها (تطبيق iOS لا يحمل إلا بيئة Kotlin واحدة، فتشترك المنتجات في إطار واحد).

شرح الاستخدام أدناه بالإنجليزية، كما يظهر في سجل الحزمة، والشيفرة نفسها في كل لغة.

Crash and error reporting for iOS apps. It reports:

  • Mach exceptions, signals, and uncaught NSExceptions;
  • app hangs: the main thread blocked for 2 s, or the time you set;
  • watchdog terminations;
  • breadcrumbs, release health (crash-free sessions and users per release), and user feedback.

In the panel, crashes are symbolicated with your dSYMs, grouped, and explained in English or Arabic.

It is a thin layer over the official Sentry Cocoa SDK (MIT), set up with your app’s Sentry DSN. Consent, the user and the install id come from the shared core.

Use it

@main
struct ShopApp: App {
    init() {
        Task {
            await Errors.start(ErrorsOptions(
                dsn: "https://ik_…@in.example.com/ingest/7", // Apps → your app → its key's DSN
                release: "[email protected]+42"
            ))
        }
    }
    var body: some Scene { WindowGroup { ContentView() } }
}

Later, Errors.capture(error:) reports a caught error, await Errors.identify(userId) names your user, and Errors.sendFeedback(text, eventId:) attaches what the user wrote.

  • A crash is sent on the next launch: the app writes the report as it dies.
  • Release health needs release. Crash-free users are counted per install, by the Sentry SDK’s installation id.

dSYMs

Upload the archive’s dSYMs after each release build, for example in an Xcode Cloud post-action or a CI step:

npx @heysada/athar-cli native build/Shop.xcarchive/dSYMs

Each architecture’s object is matched by its debug id, so it needs no release.

  • Strict mode (requireConsent: true): nothing is collected until await Errors.grant(). Until then the Sentry SDK isn’t even started, so no crash handler, sessions or requests run. revoke() and setEnabled(false) stop it, and the answer is kept across launches.
  • No IP address, cookies or headers are sent. The user is only the id you give, or else a random id for this install.