B4i Library iHockeyCrash - crash reports

Discussion in 'iOS Libraries' started by JanPRO, Aug 23, 2018.

  1. JanPRO

    JanPRO Well-Known Member Licensed User

    Name: iHockeyCrash


    Description: iHockeyCrash is a wrapper of the HockeySDK (only the crash part) and allows you to receive crash reports directly to your Hockey dashboard, where they are symbolicated automatically (no mac required, you just need to upload the dsym symbols).

    License: https://github.com/bitstadium/HockeySDK-iOS/blob/develop/LICENSE

    • first, you need to register a new iOS App at the Hockey dashboard and grab the AppID
    • download the attached "Bundle.zip" and put the HockeySDKResources.bundle into the Special folder of your project
    • the setup is very easy, use the following code in the Application_Start sub:
      HC.Initialize("YOUR APPID")
      "Ooops","The App crashed. Please help us by sending the crash log","Don't send","Send now","Always send")
      (HC is a HockeyCrash object, declared in the Process_Globals sub)
    • a crash report is send to the dashboard once the App crashes and the user opens the App again
    • you can ignore the following error: [HockeySDK] void bit_fixBackupAttributeForURL(NSURL *__strong)_block_invoke/177 ERROR: Error while setting resource value: The file “Application Support” doesn’t exist. (See also)
    Download the Library here.

    Feel free to ask questions ;)

    Attached Files:

    Last edited: Aug 23, 2018
  2. Sandman

    Sandman Well-Known Member Licensed User

    Did something go wrong when creating Bundle.zip? Seems to just contain a dir with an empty file?
  3. JanPRO

    JanPRO Well-Known Member Licensed User

    No, thats just a small "hack": Normally, the bundle has a lot's of other files (images, language files, etc), but they are not needed for the crash manager. However, the SDK is still looking for this bundle. When no bundle was found, the app crashes. To avoid this, we need this kind of dummy.

  4. Sandman

    Sandman Well-Known Member Licensed User

    Clever hack. :)

    Can you share any insights into this lib and HockeyApp? Is everything super straight forward, or are there any small oddities that are good to know?
  5. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User

    Hi JanPRO,
    Does this work with the Hosted builder. I get an error

    b4i_main.h:2:9: fatal error: 'iHockeyCrash.h' file not found
    #import "iHockeyCrash.h"
    1 error generated.

    Error: ** BUILD FAILED **
    iHockeyCrash.h is in the AdditionalLibraries directory.

  6. JanPRO

    JanPRO Well-Known Member Licensed User

    I think this is one of the most unexciting libraries for B4i (from the code perspective ;)), it doesn't even use any B4IObjects and makes less than 10 calls to the SDK. If you want I can send you the Xcode project, just PM me :)

    @Andrew (Digitwell)
    Erel needs to upload the library to the hosted builder.

  7. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User

    Let me know when that is done and I will give it another go.

  8. Sandman

    Sandman Well-Known Member Licensed User

    That sounds good, unexciting and small might make it more solid. :)

    But do tell, have you used it yourself for your projects? Do you feel this is solid enough to put in published apps?

    That's really nice of you, but I wouldn't know what to do with it. :) Perhaps just upload it in this thread so other B4i developers could learn from it?
  9. JanPRO

    JanPRO Well-Known Member Licensed User

    I didn't use such a service yet. If I tell you this library is 100% reliable I would lie, but I feel it's solid enough to use it in production (also taking into consideration that HockeyApp ist quite famous). Personally, I will use it in my next apps as the benefit is huge, for example:

    This is how a (automatically) symbolicated backtrace looks for the following error:

    -[B4IObjectWrapper object]

    *** Terminating app due to uncaught exception '', reason: 'Object was not initialized (UILabel)'

    As you can see, it's super easy to locate the issue: Main Module --> Page1_Click sub --> Label.Text

    JordiCP and Sandman like this.
  10. JanPRO

    JanPRO Well-Known Member Licensed User

    Last edited: Aug 26, 2018
    Sandman, Andrew (Digitwell) and Erel like this.
  11. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User


    I'll try this tomorrow.
  12. tufanv

    tufanv Expert Licensed User

    Great !! I will try this
  13. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User

    Just incorporated into a test app.
    It requires a lot more setup then Crashlytics on B4A, within the tool itself, but it works great.

    But it works great.

    The steps I took:

    1. Create App in Dashboard - Use the Manual Option. I also set the Release type to Beta
    2. Incorporate the App ID etc, as in the first post.
    3. In HockeyApp, Create a Version for the App - use the manual option
    The version number must match your Version in the app, I set the Build Number to 1
    I enabled External Build option on this screen as well.
    4. Upload the dSym file from your app. You can get this by Tools->Build Server -> Build Release App, then Tools->Build Server -> download last build, within the downloaded .ipa file is a .app.dSym directory, extract and then zip up separately.

    It seems that you need to create a new version with corresponding uploaded dSYM so that the the crash reports look correct with all of the correct symbols etc.
    But I will definitely be incorporating this into my next release builds.

    One final thing, I didn't get the message box on the phone telling me the app had crashed. Maybe this only appears once the app is released on the store?


    Erel, JanPRO and Sandman like this.
  14. JanPRO

    JanPRO Well-Known Member Licensed User

    @Andrew (Digitwell)
    Wow, thank you for this detailed instruction. I am sure this will help others :)
    Indeed, that's true. The symbols always needs to fit to the build, you are using the library with. In general, it's a good idea to always backup the symbol archive of release version for the store.

    No, it should work in every app build.
    Hard to to say. You should see the message box after your App crashed and you open it again. Just to clarify: You have never seen the message box? Also not one time?

  15. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User

    That's correct, I have never seen the message box. I have just run my test app 3 times in a row.

    Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
        NavControl = Nav
        Page1.Title = 
    "Page 1"
        Page1.RootPanel.Color = 
    Dim hc As HockeyCrash
    "Ooops","The App crashed. Please help us by sending the crash log","Don't send","Send now","Always send")

    5000'Needed to allow HC initialization to complete, not needed in a real app
    End Sub

    Private Sub Page1_Resize(Width As Int, Height As Int)
    End Sub

    Private Sub Application_Background
    End Sub

    Sub CrashHere
    End Sub

    Sub CrashMod
        lbl.Text = 
    "Crash Here"

    End Sub
  16. JanPRO

    JanPRO Well-Known Member Licensed User

    Your code is absolutely fine.
    Did you copy the HockeySDKResources.bundle to your special folder?
    Do you receive any logs with the HockeyApp tag (except from [HockeySDK] void bit_fixBackupAttributeForURL ...) ?

  17. Andrew (Digitwell)

    Andrew (Digitwell) Active Member Licensed User

    Ah, I had forgotten to put the bundle in the Special Folder. :oops: The message box now appears.

    TBH, I prefer it to just to send the crash report without giving the user the option. Is it safe to leave this bundle out, do you think Apple will reject without it?
  18. JanPRO

    JanPRO Well-Known Member Licensed User

    Yes, it should be safe. Alternatively you can set the CrashManagerStatus property to CrashManagerStatusAutoSend.

  19. Sandman

    Sandman Well-Known Member Licensed User

    Just to be sure: Are you saying that Apple will have no problems with us sending crash reports without asking for the users' permission first?
  20. JanPRO

    JanPRO Well-Known Member Licensed User

    No. From the technical perspective Apple will accept the App without this bundle (99% sure), I haven't check whether this proceeding is compliant with Apple guidelines.

    I am not a lawyer, but you should also check the laws of your country. In Germany for example we have to give users the option to disable Google analytics, I guess it's the same for crash reporting.

    Last edited: Aug 27, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice