Latest 1.0.1
Homepage https://github.com/esttorhe/crash-report-assert
License GNU GPL
Platforms ios 5.0
Authors

Custom assertion

Thanks to the article by Mike Ash (see legal at the bottom) I came to the realization that the assertions provided by default although good in principle lack a lot of potential and decided that a better one could be done with some simple tweakings from the code in the article.
For this I created a "custom" assertion that also supports the use of CocoaLumberjack and has a "hack" to throw exceptions when the assertion fails (instead of just aborting).

The assertion has a couple of possible "configurations" explained below.

Features supported

  • Assertion supports the use of CocoaLumberjack [GitHub Repo] for more detailed logging.
    • In order to use it you need to set the PREPROCESSOR macro USE_LUMBERJACK=1 and configure the loggers for CocoaLumberjack (demo app does this)
  • Assertion also supports a “hack” to make the assertion reach the CrashReport via a flag that will output the assert as an exception.
    Note: The “extra” data will just appear in the CrashReport pointing to the line where the assertion was called.
    • To do this specify the PREPROCESSOR macro kSHOULD_THROW_EXCEPTION=1 and this will make the assertion to build a “custom” exception with the following data:
      • Message: Assertion Failure – #expression
      • Reason: #expression
      • User Info:
        • File: File name where the assertion failed
        • Line: Line number on the file where the assertion failed
        • Function: The name of the function where the assertion failed
        • Message: The custom message provided to the assertion (if any)

To-Do

  • Add support for FlurrySDK (Logging the custom exception to Flurry as a way to reach all the possible data)
  • Add support for Crittercism (Same as FlurrySDK)
  • Add an automatic way of sending the CocoaLumberjack logs compressed to a desired location

Legal

Based on an article by Mike Ash – Friday Q&A 2013-05-03: Proper Use of Asserts

Icon was taken from IconFinder.com
And used under this license

License

This code is under the GNU GPL License attached to the repository. Link to file here.

Latest podspec

{
    "name": "crash-report-assert",
    "version": "1.0.1",
    "summary": "Custom Assertion with a \"hack\" to throw exceptions when the assertion fails (instead of just aborting).",
    "description": "  

Custom assertion

nThanks to the article by Mike Ash (see legal at the bottom) I came to the realization that the assertions provided by default although good in principle lack a lot of potential and decided that a better one could be done with some simple tweakings from the code in the article.
nFor this I created a "custom" assertion that also supports the use of CocoaLumberjack and has a "hack" to throw exceptions when the assertion fails (instead of just aborting).n

nThe assertion has a couple of possible "configurations" explained below.nn

Features supported

n
    n
  • Assertion supports the use of CocoaLumberjack [GitHub Repo] for more detailed logging.n
      n
    • In order to use it you need to set the PREPROCESSOR macro USE_LUMBERJACK=1 and configure the loggers for CocoaLumberjack (demo app does this)
    • n
    n
  • n
  • Assertion also supports a "hack" to make the assertion reach the CrashReport via a flag that will output the assert as an exception.
    n Note: The "extra" data will just appear in the CrashReport pointing to the line where the assertion was called.n
      n
    • To do this specify the PREPROCESSOR macro kSHOULD_THROW_EXCEPTION=1 and this will make the assertion to build a "custom" exception with the following data:n
        n
      • Message: Assertion Failure - #expression
      • n
      • Reason: #expression
      • n
      • User Info:n
          n
        • File: File name where the assertion failed
        • n
        • Line: Line number on the file where the assertion failed
        • n
        • Function: The name of the function where the assertion failed
        • n
        • Message: The custom message provided to the assertion (if any)
        • n
        n
      • n
      n
    • n
    n
  • n
nn

To-Do

n
    n
  • Add support for FlurrySDK (Logging the custom exception to Flurry as a way to reach all the possible data)
  • n
  • Add support for Crittercism (Same as FlurrySDK)
  • n
  • Add an automatic way of sending the CocoaLumberjack logs compressed to a desired location
  • n
nn

Legal

nBased on an article by Mike Ash - Friday Q&A 2013-05-03: Proper Use of AssertsnnIcon was taken from IconFinder.com
nAnd used under this licensen", "homepage": "https://github.com/esttorhe/crash-report-assert", "license": { "type": "GNU GPL", "file": "GPL.md" }, "authors": { "Esteban Torres": "[email protected]" }, "source": { "git": "https://github.com/esttorhe/crash-report-assert.git", "tag": "1.0.1" }, "platforms": { "ios": "5.0" }, "source_files": "CrashReportAssert/", "requires_arc": false }

Pin It on Pinterest

Share This