我的app中有一个对象被声明为实例var。
URLRequest * myRequest
当我去使用这个课程时我:
myRequest = [[URLRequest alloc] init];
然后,当我完成它时,我:
[myRequest release];//or dealloc does the same
以下是更多代码:https://gist.github.com/1177739 在这里过去很多。
然而,当我再次使用该类时,它会通过alloc和init,但我的应用程序崩溃。
释放的指针未分配
我不明白这一点,因为我再次分配和初始化。如果我不发布,我的应用程序中的内存泄漏。感谢
答案 0 :(得分:0)
也许是你的方法
- (void)urlComplete:(NSNotification *)notification
被调用两次,将urlRequest设置为bill,然后测试它在你开始时不是nil
- (void)urlComplete:(NSNotification *)notification
方法