EXC_BAD_ACCESS signal received

前端 未结 30 3097
轮回少年
轮回少年 2020-11-22 06:37

When deploying the application to the device, the program will quit after a few cycles with the following error:

Program received signal: \"EXC_BAD_ACCESS\".         


        
30条回答
  •  春和景丽
    2020-11-22 07:08

    I've been debuging, and refactoring code to solve this error for the last four hours. A post above led me to see the problem:

    Property before:

    startPoint = [[DataPoint alloc] init] ;
    startPoint= [DataPointList objectAtIndex: 0];
    x = startPoint.x - 10; // EXC_BAD_ACCESS
    

    Property after:

    startPoint = [[DataPoint alloc] init] ;
    startPoint = [[DataPointList objectAtIndex: 0] retain];
    

    Goodbye EXC_BAD_ACCESS

    Thank you so much for your answer. I've been struggling with this problem all day. You're awesome!

提交回复
热议问题