How can I fix this SIGABRT error with my app? [closed]

这一生的挚爱 提交于 2019-12-11 01:32:33

问题


I am currently developing an app in Xcode 4 for the IPhone and I have com across this error, "Thread 1: Program Received Signal: SIGABRT", This error is in my main.m code.

//
//  main.m
//  MyCard
//
//  Created by Nazar Gren on 2/2/12.
//  Copyright (c) 2012 Nazar Gren. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "mycardAppDelegate.h"

int main(int argc, char *argv[])
{
     @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([mycardAppDelegate         class]));
     }
 }

My error appears on the line under the @autorelease pool line. In the debugger, I get this message, "This generally means that another instance of this process was already running or is hung in the debugger." And this error only occurs when I attempt to debug my app. My app doesn't even run. Can anyone help? It would be greatly appreciated.


回答1:


If this is happening on the simulator, restart your computer. If this is happening on a real device, restart the device, and if the problem persists, restart the computer as well. This problem has occurred for me multiple times, because of a zombified process left on the device/simulator when a test is unexpectedly aborted. A simple reboot will fix it.




回答2:


All your code gets run through the main.m. So what you really want to see is a stack trace and there's is a good example here, but I see you're using the autoreleasepool so you'll need something like

//
//  main.m
//  MyCard
//
//  Created by Nazar Gren on 2/2/12.
//  Copyright (c) 2012 Nazar Gren. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "mycardAppDelegate.h"

int main(int argc, char *argv[])
{
     @autoreleasepool {
        @try {
            return UIApplicationMain(argc, argv, nil, NSStringFromClass([mycardAppDelegate class]));
        } @catch (NSException *e) {
            NSLog(@"CRASH: %@", e);
            NSLog(@"Stack Trace: %@", [e callStackSymbols]);
        }
     }
 }



回答3:


This is not in Main code. Can be anywhere. Please try zombie tool in instruments. You are probably trying to access an object which has been already released. NSZombie will tell you which is the object and you can investigate from there.




回答4:


Did you remove a reference to something attached in your main storyboard?

If so, checkout the referencing outlets of that object to see if it's still trying to point to something, try removing that reference and running your simulator again...



来源:https://stackoverflow.com/questions/9122663/how-can-i-fix-this-sigabrt-error-with-my-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!