Unreproducible crash: [__NSArrayI enumerateObjectsUsingBlock:]: unrecognized selector sent to instance - ios

I keep getting crash reports with the following crash:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI enumerateObjectsUsingBlock:]: unrecognized selector sent to instance
What could be triggering this crash? An empty array or something that is not an array at all? I am not able to reproduce the crash myself, I just can see it in crash logs.

You most likely have a memory issue, the fact that you can't regularly reproduce it also suggests a memory issue.
The error you are getting is saying, "we tried to call this method on this object you have a pointer to, unfortunately the object is not the type of object you told me it was going to be."
I can really only speculate given the information you've provided. Take a really fine tooth comb through your code and make sure you are not changing that object prior to that crash happening.
Try adding a debug check to make sure its the correct class. NSAsserts are NOT the solution, they are not even compiled into production apps but, it should help find the cause of the error.
NSAssert([myObject isKindOfClass:[NSArray class]], #"aw snap its not an array!");
Post more info and I can try to help further

Related

How to identify crash from XIB

I don't have any code implemented in view controller to set the font or attributedLabel. But I'm seeing crash with below reason.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[_SwiftValue pointSize]: unrecognized selector sent to instance 0x610001040ba0
There is another way of debugging issue. When app is crashed, check left panel and you will observe threads stack. In that find out Obj_exception_throw select that and use your logging area to run command po $arg1. This may give you the correct reason for crashing.
Or else, you can try using Application Unit tests for verifying all your IBOutlets and objects, loaded from NIBs.
You can select that xib and open it as source code.
Or search tho whole project to find that.

[__NSCFType reactToAppEnteringBackground]: unrecognized selector sent to instance

-[__NSCFType reactToAppEnteringBackground]: unrecognized selector sent to instance
I'm looking at our crash logs and i got quite a few of reactToAppEnteringbackgroundcrashes. I'm not familiar with this function. I'm pretty sure we don't have a function like this in our app unless it's one of NSObject's? Basically, I couldn't get anything from the crash log to help me as I'm not able to symbolicate it. But, is anyone familiar with this crash? When does it usually happen?
UPDATE:
So i was able to symbolicate. And it led me to [VungleSDK appDidEnterBackground]. Basically, it's an external source crash. I've updated my Vungle SDK and hopefully the crash won't happen again.

Does anyone know why this exception is being thrown in ios/cordova?

I'm working on a hybrid app with a custom InAppBrowser plugin and seemingly randomly an exception gets thrown.
I don't have any way to consistently reproduce this bug. I open that app and browser around and eventually when clicking my browser plugin's close button this will happen.
It happens within cordova after I call this line here
Where the exception actually happens
CordovaLib.xcodeproj/Classes/Commands/CDVCommandDelegateImpl.m
I have spent hours trying to find what is happening and I can't find any information online that helps. I've tried wrapping it in a try/catch to at least see if I can bypass it and that doesn't work either
The actual logged error is:
*** Assertion failure in -[DDWebKitOperation dealloc], /SourceCache/MobileDataDetectorsUI/MobileDataDetectorsUI-109.1/URLification/DDOperation.m:202
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Container should already be nil'
Does anyone know what could be causing this and how to fix it?
Thanks.
I've seen this crash in UIView's that use data detectors. In my case it was in a unit test, so the fix was to delete the data detector in the test.

iOS app crashing when testing over test flight

I have an iOS app that I need to test on other devices over testflight.
When I run the app directly from XCode it works perfectly (both debug and release mode).
But when I archive the IPA file and download it over testflight it crashes when loading a viewcontroller with a scrollview with images;.
It never crashed in Xcode,only when installing from testflight.
Stack trace I got,
: -[CALayer _isResizable]: unrecognized selector sent to
instance 0x1d570730 : * Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[CALayer
_isResizable]: unrecognized selector sent to instance 0x1d570730'
* First throw call stack: (0x32a452a3 0x3a8e597f 0x32a48e07 0x32a47531 0x3299ef68 0x3486929f 0x34861eb3 0x7a3cf 0x3486c595
0x348c114b 0x348c1091 0x348c0f75 0x348c0e99 0x348c05d9 0x348c04c1
0x348aeb93 0x348ae833 0x7860f 0x3490f28d 0x34991f81 0x33353277
0x32a1a5df 0x32a1a291 0x32a18f01 0x3298bebd 0x3298bd49 0x365552eb
0x348a1301 0x30e1f 0x3ad1cb20)
What can cause such a problem?
The crash is 100% unrelated to the distribution method (here OTA distribution of an Ad-Hoc build via Testflight).
You need to symbolicate that crash report using Xcode and will then see the file, method and line number in your app where it crashes. Drag the crash report into Xcode organizer crashes section and hope you still have all the files required for this to work. That is the .app and .dSYM bundles that where generated for this build and these being indexed via Spotlight.
The exception message is already pretty clear and says a lot about what is happening:
: -[CALayer _isResizable]: unrecognized selector sent to instance 0x1d570730 : * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer _isResizable]: unrecognized selector sent to instance 0x1d570730' *
The exception is a NSInvalidArgumentException
You code is calling a method/selector on an object that doesn't know this method/selector
This hints that you are having a memory issue (No, ARC is no magic and does NOT solve all your memory issues automatically)
Check your code for retain cycles (e.g. when using async completion blocks), memory leaks or zombies. Basically check for any memory related problem. There are multiple threads and documentation on StackOverflow or other places on what to do and how to check for these.

iOS – Weird exception

I'm getting a strange exception in Xcode 4.2.1 (ARC-enabled project) that I can't track down to the root of the problem.
This is what the exception looks like:
2012-03-18 22:19:32.855 Project[14225:707] +[UIPickerTableViewTitledCell isEqualToString:]: unrecognized selector sent to class 0x3f2bbec4
2012-03-18 22:19:32.859 Project[14225:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIPickerTableViewTitledCell isEqualToString:]: unrecognized selector sent to class 0x3f2bbec4'
What is a UIPickerTableViewTitledCell? I suppose it is some internal class for the UIPickerView to use. But I'm not referencing that class anywhere in my project.
My application is setup as a Tab Bar application with a navigation controller in each tab and this particular tab has a tableview and pickerview.
It sounds like you have an over-released object. I get that when in pre-ARC code, release is called one too many times. The code sounds like it is looking for an NSString to send isEqualToString: to but instead of getting the NSString which has been released already, it gets this random instance of UIPickerTableViewTitledCell.
I would enable Zombies. In Xcode 4.2.1, you can find it in the menu item Product > Edit Scheme. Go to the Diagnostics tab. Then there is an Enable Zombie Objects checkbox. This will make your over-released object into a Zombie, so you can figure out exactly what object is causing your crash.
I would read the Apple doc Technical Note TN2239: iOS Debugging Magic for more in-depth information on this. The whole doc is great, but you can start off by reading the sections titled "Zombies!" and "More Zombies!"

Resources