I have an empty block which runs fine in iPhone 6.0 simulator in Xcode, however when I switch to the iPhone 5.1 simulator I get the following exception: "EXC_BAD_ACCESS".
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// I've removed all code from here and exception still occurs.
});
Any ideas what causes this? The exception is thrown at the dispatch_async line. Not sure if it matters, though I am using ARC.
Mistake on my part, I had the iOS Deployment Target set at 6.0. I've updated it to 5.1 now and it works fine.
Related
After upgrading to Xcode 11.3, our app throws an exception when running on an iOS 13.3 device. The exception does not occur at the same place every time, and the log indicates the exception is coming from com.apple.CoreAnalytics (see below). The exception is only thrown once. And, the exception is NOT thrown when I run the app on the simulator. Thanks in advance for your thoughts and ideas!
Sometimes Apple's frameworks use exceptions as an internal messaging technique. They probably shouldn't do that, but the frameworks contain a lot of old code that doesn't always follow best practices. There is no harm done, because the framework, having thrown the exception, also catches it, which is why you run fine if the app just runs without the debugger. But if you run from Xcode and you have set an Exception Breakpoint, you will pause after the throw but before the catch. It looks like that's what's happening. So just remove that breakpoint.
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
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
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.
My iOS app is crashing immediately without any debug info. I have a break point all objective-c exceptions.
Crashing on this line
return UIApplicationMain(argc, argv, nil, NSStringFromClass([STAppDelegate class]));
App was running fine for the past month and nothing was changed.
I cleaned are re-ran.
What is weird is it is crashing every other time I run so run once its good stop it and run again crashed .... repeat rinse same result... every other time.
I am getting closer after installing 4.6.2. Now it crashes everytime and I get this error."erminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIStoryboardUnwindSegueTemplate'"
This is an altogether different story, it looks like a problem similar to use autolayout on iOS version lower than 6.x...
You cannot use storyboard with iOS 5.x as deployment target.
Getting back to your original problem, Xcode 4.6.2 app crashes on every second run, it gets solved either updating to the latest XCode 4.6.3 or using GDB instead of LLDB. I suggest, however, to update to the latest version and hence use LLDB - by the way, it looks like the next XCode 5 will support exclusively LLDB.