WebThread crashes on over-released CA object - ios

I have built an App in Swift but with Cordova which is Obj C. I also use crashlytics. I'm seeing a crash in about 10% of users, previously I experienced it a lot myself when using the debugger but since iOS 8.3 I don't, but that doesn't seem to have reduced the problem in the wild.
The crash is EXC_BAD_ACCESS KERN_INVALID_ADDRESS in CA::release_objects(X::List<void const*>*) + 32, called when the autorelease pool is drained. The crash is always in the WebThread.
I can't seem to reproduce locally with Zombies profiling, so it is difficult to narrow down any further, but I can't see what would be causing this in my code. I do use Core Animation but only in swift, and this was happening before I added the CA code. I use UIView animations, but again it is all in Swift with Storyboards and I can't think where anything would be going wrong. Any suggestions?

Related

objc_release crash with no origin in my code

I'm getting this strange crash with no indication from where it's going. I am not able to reproduce this on my devices. Any idea what could be wrong and where to look for the problem?
It looks it happens in autorelease pool cleaning in main loop, however I am not affecting it in my app - I am using ARC. The AppDelegate.swift line 21 is just declaration of AppDelagate class.
I am not able to reproduce this problem on any of my devices (I have about 8 of them), but this crash happens to about 10% of users of the new version, so that it is pretty frequent. I tried some build as the AppStore one.
Thanks,
Jindrich

Memory Leaks in NSBundle iOS 13

I have a memory leak in my iOS app, some of the leaks were due to my code written which i was able to fix. But this i was unable to know what the issue was. Any one who can help me with this.
This is the screenshot for reference:

iOS App crash with SIGTRAP in iPhone 6 plus?

I have an app which is written in swift and uses AFNetwork and some other helpers written in Obj c. On my clients device (iPhone 6+) he is getting an SIGTRAP error, I have tried to recreate the issue on the testing devices that we have and on all the simulators but could not recreate it.
Below is the stack trace, it crashed twice:
http://paste.ubuntu.com/12077304/
When I symbolicate the crash report it is pointing to:
-[Instagram getOwnBaseUrl] (in DiaryApp) (Instagram.m:118)
And on the second instance it point to:
[UIAlertView(AFNetworking) showAlertViewForTaskWithErrorOnCompletion:delegate:cancelButtonTitle:otherButtonTitles:]_block_invoke (in DiaryApp) (UIAlertView+AFNetworking.m:72)
Crash Log : http://paste.ubuntu.com/12077328/
I am not able to pin point the exact cause for the crash. Any help in this regard will be highly appreciated.
Thanks.
SIGTRAP is not the error it is the exception. It doesn't show the origin of the crash. This exceptions throw into Main thread on Main/Next Runloop, so the stacktrace of the main thread does not show the origin of it.
It happen like NSArray indexOutOfBounds or library or anything else
reference link
signal Types

Transitioning an Objective C project to ARC and get rid of multiple app crashes

I spent few days working on an app that was built by my friend last year before the release of iOS 8 and Xcode 6+ I believe. He used several libraries like PMCalender , FXforms, MyBlurIntroductionView, CCPickerView, SWRevealTableView etc and I added MBProgressHUD. Now before the app was running without crashes or now as I understand after further studying of the problems I am getting with the app. I believe the app has multiple because of memory leaks. I read his code before modifying it and just noticed there are compile sources he put i.e -fno-objc-arc or fobjc-arc. About a day ago after attempting to integrate SPGooglePlaceAutocomplete for some reason I had to disable Objective-C ARC from Build Settings and then the whole project build with lots of errors. That I had to change weak object to strong in some header file and so forth.
Now I tried to read this for more understanding Apple Transitioning to ARC release NOte
I am posting this question because I'm would say I'm a newbie to iOS development but catching up pretty fast. I need help to have a smooth running app with crashes because. What I am experiencing is not clear to the point that I had to use Instruments to see exactly what is causing the app to crash whereas coming into the app several time at some point it does not crash. When it crashes I get this only thread x and can't really know where to debug
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
The add has MapKit and first thing after login screen it should zoom to the user current location. Reason why I used Instruments to see what is happening with the app is because I was suspecting perhaps CoreLocation is causing the crash to connect to the remote CCLocationManager services. As I noticed my phone takes time to turn on gps and it does not always stay on even if I have request location always [self.locationManager requestAlwaysAuthorization];
So I am hoping someone can help me because I did the whole ARC transitioning but still have release, autorelease errors. All my IUOutlet are weak.
Here are the 6 errors I am left with removing with hoping the app will run normal.
I this this is the answer to my question, which can be helpful to others after long search and debugging.
http://www.daveoncode.com/2011/10/24/migration-to-arc-automatic-reference-counting-using-xcode-4-2-refactor/

iOS - EXC_BAD_ACCESS code = 1 UIWebView crashes after (method swizzling) init

I just switched my app over to ARC. The transition was a partial success thanks to the refactoring tool that Xcode provides. The one part that doesn't work is a strange error.
I used method swizzling (method_exchangeImplementations) so that instead of calling UIView's initWithFrame, it will call my myInitWithFrame code. The refactoring process threw an error at the method declaration of myInitWithFrame, so I added the __attribute__((objc_method_family(init))) after the declaration of the method. Now this all works perfectly fine for iOS 6.0 and above, but on iOS 5.0 (the lowest iOS I would like to support) it doesn't work. I'm getting an EXC_BAD_ACCESS (code=1, address=0X28). On every run the exact same memory address comes up.
I have a UIWebView that calls it's:
[[UIWebView alloc] initWithFrame:webViewFrame];
After the myInitWithFrame does it's initialization, it returns self, then it crashes.
On the thread trace, it says that it crashes in apples's code (the method is greyed out) on the [UIWebView retain] method, as seen below.
Thread 1, Queue : com.apple.main-thread
#0 0x3515a7d2 in -[UIWebView retain] ()
#1 0x316ddef4 in objc_retain ()
#2 0x0011528c in -[UIView(style) myInitWithFrame:]
Sorry that the thread trace isn't very well formatted, I don't have enough rep to post an image.
Is there any reason why the same code works for iOS 6.0, but not iOS 5.0?
This issue was very complicated to fix. The fact that this issue only showed up on iOS 5, and not iOS 6 was my first indication that this may be an apple issue, or an method swizzling issue. After about a week of searching I came to the consensus that I should email Apple technical support, to see if they could help me with this issue.
Their response was that it's both our faults. He said that in iOS 5 UIWebView keeps track of it's own retain count (using a UIWebViewInternal class), and that my method swizzling was retaining the object before it was fully initialized, and that caused the crash. When I didn't use ARC it wasn't an issue, because I never call retain in the init function, but with ARC it adds retains as it "sees" fit. He mentioned that in iOS 6 the UIWebViews don't manage their own retain count, and that's why it worked in iOS 6.

Resources