rollbar / rollbar-ios

Objective-C library for crash reporting and logging with Rollbar.
https://docs.rollbar.com/docs/ios
MIT License
65 stars 61 forks source link

App crashes on fresh integration with Rollbar #246

Closed deni2s closed 4 years ago

deni2s commented 4 years ago

Just tried to integrate Rollbar, installed 1.8.4 with CocoaPods, added required code in AppDelegate.swift and instantly got a crash when trying to init Rollbar - Rollbar.initWithAccessToken("mytoken").

looks like issue is in KSCrash.m file - (NSArray*) allReports { int reportCount = kscrash_getReportCount(); int64_t reportIDs[reportCount]; reportCount is 0, but reportIDs array is empty, so getting "Non positive vla index" error: file:///Users/deniss/Desktop/AlphaSense/Pods/Rollbar/KSCrash/Source/KSCrash/Recording/KSCrash.m: runtime: Undefined Behavior: Variable length array bound evaluates to non-positive value 0 .

akornich commented 4 years ago

@deni2s , we are on v1.11.3 now. Many fixes and improvements were made since v1.8.4. Please, gie a try to the most recent release.

deni2s commented 4 years ago

@akornich you should update the documentation on website then, as it has 1.8.x in podfile.

deni2s commented 4 years ago

Updated to 1.11.3, had to change target version of Rollbar from iOS 8 to iOS 11, to get rid of some warnings. After that got several warnings about using deprecated methods... Still experienced the original issue. Someone from support wrote me that I should create Bridging-header file (again, not in documentation on website I saw) with #import <SystemConfiguration/SystemConfiguration.h>

import <Rollbar/Rollbar.h> in it. After that project is not compiling, as it can't find Rollbar.h file mentioned in Bridging-header file... So stuck here again. After all these issues I start to reconsider if Rollbar is production ready...

letaniaferreira commented 4 years ago

Hello @deni2s I am not sure where you are getting your information from. I want to make sure that you are looking at the official documentation: https://docs.rollbar.com/docs/ios#section-swift

akornich commented 4 years ago

@deni2s , instead of #import <Rollbar/Rollbar.h> please, use: EITHER @import Rollbar; // in Objective-C client code OR import Rollbar // in Swift client code

I'll update the docs to reflect this recent change (moving to a more modern and efficient way of importing modules).

deni2s commented 4 years ago

@akornich I did as you suggested, app with v 1.11.3 compiles now, but still crashes same way as in my first comment.

akornich commented 4 years ago

@deni2s , can you post here a small app/project that reproduces the problem?

deni2s commented 4 years ago

@akornich got it running by turning off "Undefined Behavior (Runtime issue)" breakpoint in project. Never experienced it before, so I thought app crashed, when it just hit this breakpoint.

But still see in console logs: /Pods/Rollbar/KSCrash/Source/KSCrash/Recording/KSCrash.m:514:23: runtime error: variable length array bound evaluates to non-positive value 0 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/deniss/Desktop/AlphaSense/Pods/Rollbar/KSCrash/Source/KSCrash/Recording/KSCrash.m:514:23 in 2020-02-17 12:12:33.183919+0200 AlphaSense[42472:1735234] [Rollbar] Success

akornich commented 4 years ago

@deni2s , KSCrash is a third party library we are using for capturing crash reports. You may want to report the error in KSCrash repo. We periodically update our repo to reference newer releases of KSCrash, so once they have a fix released we can repoint to that one. So, can we close this issue for now?

deni2s commented 4 years ago

Yes, thanks.