Onesignal-ios-sdk: Crash on iOS 11 with class_getSuperclass - SDK 2.5.4 through 2.5.6

Created on 19 Sep 2017  路  37Comments  路  Source: OneSignal/OneSignal-iOS-SDK

This happens inconsistently, unfortunately. I imagine that turning this from a do-while to a straight-up while loop would fix the issue. You can check out the project where this is happening at https://github.com/OneBusAway/onebusaway-iphone/

screen shot 2017-09-19 at 12 14 03 am

Medium Priority

Most helpful comment

Reopening, report of crash still happening on version 2.5.5, issue #240

All 37 comments

I think it's the same issue as #274. @jkasten2 Can you reproduce the issue with this repo?

Yeah, this looks like the same issue to me. I'm happy to help out in any way I can. LMK if there's anything I can vis-a-vis the OSS project I linked to above or anything else.

@aaronbrethorst Tried building and running the project you linked to above. Launched the app a number of times on iOS 11 on both a simulator and a real device and wasn't able to reproduce the issue. However I agree with your suggestion on preventing any possible nil errors.

The fix will be available in the next release.

Cool, thank you! Do you have an estimated date for release?

I have build against master but still see the issue popping up (same location as screenshot above). Maybe something went wrong with your push/merging to master?

@hixfield I have verified the change is on master correctly.
https://github.com/OneSignal/OneSignal-iOS-SDK/blob/master/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.m#L103

Can do clean build to ensure you have the change in your project? If you are still seeing a crash can you verify the stack trace isn't different in anyway?

If you're using CocoaPods you can't just point it at the master branch in this repo because it will just pull the prebuilt framework down, which doesnt have the fix yet. I worked around this by forking the repo, compiling the framework and pushing it to the fork, then pointing CocoaPods at the fork. I assume it would be the same with other dependency managers too.

I am using cartage

This is the contents of my cart file:

github "OneSignal/OneSignal-iOS-SDK" "master"

I verified in the carthage/checkouts folder and can confirm that the source includes the fix.
Maybe something else went wrong, I will do a rebuild (including carthage) and keep an eye on it to see if it happens again.

The crash is still happening for me even with the fix applied. If you want to test with the applied fix change your carthage line to:

github "gerbiljames/OneSignal-iOS-SDK" "master"

FYI, I was also seeing this crash. I've switched to this fork: https://github.com/franklyinc/OneSignal-iOS-SDK and haven't seen the crash since.

@DaveWoodCom For me 19/46 UITests failed due to this crash before switching to franklyinc's fork, and 2/46 after. So much better but still crashing.

@alexandre-g Could you share the 2 stack trace of the 2 crashes you are still getting?

@jkasten2 I don't see a way to get them from Integration logs but have a colleague who is writing new tests and asked him to take a screenshot when he encounters

@jkasten2 Actually there is a way to get the crash logs, strange that I didn't see it the first time I looked.

http://goloskok.com/u/snippet-mwPOMZUK3q.txt

Version 2.5.5 has been released to CocoaPods with a fix for this.

@alexandre-g If you continue to see an issue could you share a new unit test project reproducing it?

Reopening, report of crash still happening on version 2.5.5, issue #240

Still getting this crash on 2.5.6, sometimes it can be as bad as every other launch via Xcode's simulator

@jkasten2 I've tried reproducing this on a new project with OneSignal initted same way, but couldn't get it to crash. So then I approached it from the other direction - I've started stripping away code and files from the original project to see at what stage it would stop crashing, but could not find the exact place. It seemed like the more files I remove, the less often the crash occurs

Have anyone experienced this crash on real iOS device? I wonder whether this is simulator-only or not and whether it will affect real users.

I'm pretty sure I was getting this crash on real devices, but can't say 100% since the crash logs weren't very useful. But the crashes did go away when I switched to the https://github.com/franklyinc/OneSignal-iOS-SDK fork.

I have the same issue with the latest release happening on simulator.

I have never had this happen on a real device, according to Fabric...however I'm not sure if Fabric would even report it properly if it did since it's so early at launch.

Me neither, but it looks like it depends on other custom code too.

Still having this issue with the latest release of OneSignal. Can't confirm or deny if I've had it on a real device though.

I also still continue to have this error, but it only occurs on the simulator.

Is the stack trace any different on version 2.5.6 than the original post? Is it still crashing on class_getSuperclass?

Still crashing at the same place. Version 2.5.6.
screen shot 2017-10-19 at 10 51 46

For me, the bug occurs exactly as shown above by laurent-humbert (stuck on movq under ClassGetSubclasses). I believe it only happens when running via Xcode's simulator - not on a physical device. Here's a screenshot of the crash:
screen shot 2017-10-20 at 16 32 49

It crashes every time on device if Malloc Scribble is enabled.

Do you have an ETA or any updates on a fix for this?

@revolter Thanks, however still was not able to reproduce the issue on a simulator or device.

OneSignal SDK Debugging

I have created a debug branch that will output all class names before class_getSuperclass is called on them. This is the getSuperclass_debugging branch. Copy and replace the iOS_SDK/OneSignalSDK/Framework/OneSignal.framework from this branch into your project replacing the current OneSignal SDK.
The output from this could be rather long, only the first 20 or so lines and the last 20 or so lines is needed to debug the issue.

Zombie Objects

With or without the debug version above enabling "Zombie Objects" may provide some extra entries to the xcode log while the app is running that will be helpful.
image

With this new framework, it doesn't crash. I previously had version 2.5.4 installed.

I've created this pull request https://github.com/OneSignal/OneSignal-iOS-SDK/pull/297 to provide the option of disabling OneSignal.load() without altering much of the codes.

Simply pass DISABLE_ONESIGNAL as arguments to ProcessInfo. This is useful for selectively turning off OneSignal.load() for simulator builds or XCUITest (which is failing for me)

This is my fork branch
https://github.com/depoon/OneSignal-iOS-SDK/tree/DisableOneSignalUsingInfoProcessToFixCrash

I made a PR to fix similar crash on simulator. (https://github.com/OneSignal/OneSignal-iOS-SDK/pull/298)

I am now able to reproduce this crash. I have a branch with a fix available below.
https://github.com/OneSignal/OneSignal-iOS-SDK/tree/ios11_startup_crash_fix

After some additional testing it will be released in the next update.

The fix is now included in the 2.5.7 SDK Release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luai-kalkatawi picture luai-kalkatawi  路  4Comments

arthurdapaz picture arthurdapaz  路  5Comments

basememara picture basememara  路  4Comments

cassidyclawson picture cassidyclawson  路  5Comments

huahengling picture huahengling  路  5Comments