Crash without warning xcode - ios

I am developing the application for over 6 month.
After everithing was developed and tested, I put app aside for 2 weeks and now when I run it it start crashing without any warning:
Even if I hit Continue Execution over 20 times still nothing in log.
I have all exceptions break point and malloc_errer_break set.
App crash when I move from screen to screen (When I open 2 screen or when I close it).

Most of the time EXC_BAD_ACCESS happens when you use an object that no longer exists.
You could check for Zombies during run-time to see if you use any of your object which doesn't exist anymore.

Let me guess - you need to change a property to strong (from weak). Name of that problematic property you will find in the console after enabling check for zombies (press ⌘⇧< then check Enable Zombie Objects in Diagnostics/Memory Management)

This a very generic error, I suggest to review your code and try again and as Anc Ainu said the reason is of using an object thats no longer exists.

I recommend to set up Exception breakpoint to get place from
which your app crashes.
To make this breakpoint enabled go to breakpoint tab, then tap on plus button and choose 'Add Exception Breakpoint'.
2. And yes, enabling NSZombies also could help
you.

Related

WKWebView error calling any javascript in iOS 10 while debugging

Fun error that ONLY happens in iOS 10, when debugging on a physical device. It does not happen in the simulator, or when running on the physical device (while not debugging). It also does not happen on an iOS 9 device in any situation...only iOS 10 while debugging and after any javascript call has been executed.
I have a hybrid web app, written in Swift 2.3, after the xwebview loads I call various javascript methods...actually, any in this case. Anyway, after the javascript method has finished I get a malloc error saying I'm trying to free a pointer.
malloc: *** error for object 0x1740b5060: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
So I set the break point...and it never breaks on the breakpoint, it just keeps telling me to set a breakpoint.
If I remove all of my javascript calls, the error never happens. I've tried enabling them one by one, it doesn't matter, they all break after the callback returns.
I've been after this for about 2 weeks, I'm out of extra hair to pull out. At this point I'd love to hear if someone else is seeing the same thing.
It looks like its a safari bug and therefore only appears when you are debugging your webview with safari. In Safari under Develop->Your_Device_Name uncheck "Automatically Show Web Inspector for JSContexts".
This should resolve your issue.

Track a zombie object in xcode

I'm getting this error exc_bad_access code=1 address= xcodein my IOS app so I've tried to use the zombie tool like this :
Product->Profile->Zombies then I click on start recording (the red dot)
Also I've check the Enable Zombie Objects in
Product->Scheme->Edit scheme->Run->Diagnostics
The problem is when I'm using the zombie mode and I try to simulate the error, the error is not simulated, not detected. When I run my project in normal mode, debug, the error occurs and the app crash.
So what I've missed here ?
Note this is the first time I use the zombie tools. Thanks.
Update
Error :
The problem with NSZombie here is that it keeps objects alive instead of deallocating them, but turns them into special objects that complain as soon as you try to call a method on them.
However, if you have some code like a block that just tries to access an instance variable (without calling a method on that object), this will now succeed as the object's memory region is now still available.
If you haven't done so already, simply try running your code in the normal debugger without NSZombie as that should tell you where the crash happens in the stack trace.

EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) Only when running app on device from Xcode

I'm getting a really weird EXC_BAD_ACCESS(Code=EXC_ARM_DA_ALIGN) crash on my app which is written in swift but only when i run it on a 32 bit device and only if its running from Xcode (the device is still hooked to Xcode), If i start the app without Xcode it runs fine. I can't give any code since no matter what i do i get no stack trace or anything like that .Only the mention error on the AppDelegate, even though the crash is in different screens further in the app (crashes on second screen).
Any idea as to why the crash would happen only when Xcode is running the app
You are using some variable or object which is yet to be initialised. Please review your code and you will get the error. You can add exceptional break point to get the actual position of the error.
It's a memory alignment issue. Search on EXC_ARM_DA_ALIGN.
https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/knowledgebase/docs/kb95.html
use memcpy
char*Code; int pc;
double f;
memcpy(Code+pc, &f, sizeof(f)); // instead of *(double*)(Code+pc)=f; that generates EXC_ARM_DA_ALIGN

Symbolic breakpoint on [UIViewController initWithCoder:] causes debugger to freeze

I am trying to set a symbolic breakpoint to detect when my view controllers are being unarchived. The breakpoint breaks properly on [UIViewController initWithCoder:] once the app is launched on my test device.
However, when I try to move past the breakpoint by pressing 'Continue' the debugger freezes: it stops responding to commands from Xcode (eg. 'pause' and 'stop') and the app itself hangs as well. I end up having to force quit and restart Xcode in order to relaunch the app.
The 'Step Into' functionality works as expected, but leads me directly into machine code - I'd like to be able to use the 'Continue' function to proceed with normal program execution. The app and debugger function normally if I disable this particular symbolic breakpoint.
Any insight into this problem would be helpful. I'm running Xcode 5.0.2 and using the LLDB debugger.
EDIT: I tried the solution described here, but had no luck.
I ended up setting the breakpoint to log a message to the console, and selected the 'automatically continue after evaluating' option.
This sounds like a bug. Can you take a sample of Xcode while it is frozen like this and file a bug with bugreporter.apple.com and include the sample? Thanks.

Xcode console wont show error details

I have been developing iOS applications for about 2 years and have never come across this before.
I recently took on a project, but for some reason whenever it crashes while I am debugging the console shows no details about the error. The code highlights with a SIGABRT or ESC_BAD_ACCESS but never tells me the details of the crash in the console (like unrecognised selector sent to instance etc.)
I've come to the conclusion this is a problem with the project settings as I test other apps with the same xCode and don't have the same problem.
I've looked all over but can't find anyone with a similar problem please help!
Try adding an Exception breakpoint:
Open the breakpoint navigator and click the + icon and add an exception breakpoint
Add a breakpoint with the settings as shown
I don't think this is an Xcode problem. But try this two options:
1) In your VC or AppDelegate perform crash on purpose for example:
[self performSelector:#selector(methodNameNotExistingInMyProject:) withObject:nil];
This should return you some console output
2) Are you sure you have Debug configuration in scheme? You may want to check it out.

Resources