gpt4 book ai didi

iphone - 使用 url 连接时我的应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 03:58:16 25 4
gpt4 key购买 nike

我正在开发基于服务器的项目,如果我一一推送到3个 View Controller ..每个 View 我都请求网址并且我正在从服务器获取数据,在这种情况下它工作正常,但是当我弹出时(或者)回到上一个 View ,连续单击后退按钮,我的应用程序崩溃,因为来自服务器的数据未完全接收,我再次请求另一个网址

 - (void)connectionDidFinishLoading:(NSURLConnection *)connection {

[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

[self hideLoader];

if (_delegate != nil) {

NSMutableData *data = [[NSMutableData alloc]initWithData:responseData];

[_delegate finishedReceivingData:data withRequestMessage:requestMessage];

[data release];

} -- getting error here..

我还想要我的应用程序的崩溃报告,有没有框架?

最佳答案

在 Controller / View 的 dealloc 方法中(取决于谁是你的委托(delegate)),你需要将你的委托(delegate)属性设为 nil。

- (void)dealloc
{
_urlConnection.delegate = nil;

[super dealloc];
}

不要指望 nil 条件。它可以被释放,但不能为零。

关于iphone - 使用 url 连接时我的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16214353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com