EXC_BAD_ACCESS signal received

前端 未结 30 2763
轮回少年
轮回少年 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 06:51

    Just to add another situation where this can happen:

    I had the code:

    NSMutableString *string;
    [string   appendWithFormat:@"foo"];
    

    Obviously I had forgotten to allocate memory for the string:

    NSMutableString *string = [[NSMutableString alloc] init];
    [string   appendWithFormat:@"foo"];
    

    fixes the problem.

提交回复
热议问题