警告无法恢复上一帧并给出错误:EXC_BAD_ACCESS

时间:2012-03-11 04:56:48

标签: iphone objective-c tbxml yahoo-weather-api

我的iPhone应用程序崩溃并发出以下警告

warning: Unable to restore previously selected frame.
Current language:  auto; currently objective-c
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.

这是代码崩溃的代码

+(id) tbxmlWithURL:(NSURL*)aURL;{
    return [[TBXML alloc] initWithURL:aURL];
}


-(id)initWithURL:(NSURL*)aURL{
    return [self initWithURL:aURL];
}

1 个答案:

答案 0 :(得分:2)

您的-initWithURL:方法以递归方式调用自身。每次执行此操作时,它都会添加一个堆栈帧,最终会耗尽堆栈空间并导致崩溃。发生这种情况时,调试器通常不会为您提供更多有用的信息。

你的意思是?

-(id)initWithURL:(NSURL*)aURL{
    return [super initWithURL:aURL];
}