为什么我的 nimbus didImageLoad 方法没有被调用?

发布于 2025-01-01 04:23:46 字数 1654 浏览 1 评论 0原文

我是 Nimbus 的新手。现在我的应用程序正在尝试通过此代码检索 4 个图像:

for (int i=minFoto; i<=maxFoto; i++) {

    NINetworkImageView* networkImageView = [self networkImageView];

    NSString *resourceURL = [NSString stringWithFormat:@"%@registration/rest/users/account_get_foto/%@?fotoId=%d", baseURL, ssid,  i];

    NSLog(resourceURL);

    [networkImageView setPathToNetworkImage:resourceURL
                             forDisplaySize: CGSizeMake(50, 50)
                                contentMode: networkImageView.contentMode];

我知道我的循环正在工作,因为我看到所有四个 NSLog 都正确输出。但是,我只得到第一张图像。 networkImageViewDidStartLoad 仅被调用一次,并且 didLoadImage 或 networkImageViewDidFailLoad 均未被调用。我认为 didLoadImage 从未被调用很奇怪。绝不。我知道我有数据,因为我正在使用 CharlieProxy(顺便说一句,很棒的应用程序,非常值得 50 美元),它在响应数据包中显示图像数据。

所以我从我的委托中对此进行了评论:

[[Nimbus networkOperationQueue] setMaxConcurrentOperationCount:1];

正如您所期望的那样,我收到了 4 次对 networkImageViewDidStartLoad 的调用,但对 didLoadImage 或 networkImageViewDidFailLoad 的调用仍然为零。

这是我的请求标头(来自 CharlieProxy)

GET /registration/rest/users/account_get_foto/fdbc2222-7b75-4ff4-b111-623e951e5b00?fotoId=134     HTTP/1.1
Host: -------------:8080
User-Agent: Ferret/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

,这是响应标头,显示“200 OK”

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet/3.0; JBossAS-6
Content-Type: image/*
Content-Length: 461109
Date: Tue, 31 Jan 2012 21:12:33 GMT

âPNG (png data deleted...)

我现在有点困惑。我的服务器显然正在返回图像数据,但我的应用程序只是没有获取它。有什么想法吗?

I'm new to Nimbus. Right now my app is trying to retrieve 4 images via this code:

for (int i=minFoto; i<=maxFoto; i++) {

    NINetworkImageView* networkImageView = [self networkImageView];

    NSString *resourceURL = [NSString stringWithFormat:@"%@registration/rest/users/account_get_foto/%@?fotoId=%d", baseURL, ssid,  i];

    NSLog(resourceURL);

    [networkImageView setPathToNetworkImage:resourceURL
                             forDisplaySize: CGSizeMake(50, 50)
                                contentMode: networkImageView.contentMode];

I know my loop is working because I see all four NSLog's come out correctly. However, I am only getting the first image. networkImageViewDidStartLoad is only being called once and neither didLoadImage or networkImageViewDidFailLoad is being called. I think it is odd that didLoadImage is never being call. Never. I know I have the data because I'm using CharlieProxy (great app BTW, well worth the $50) and it shows the image data in the response packets.

So I commented this out of my delegate:

[[Nimbus networkOperationQueue] setMaxConcurrentOperationCount:1];

And as you might expect, I'm getting 4 calls to networkImageViewDidStartLoad, and still zero to didLoadImage or networkImageViewDidFailLoad.

Here are my request headers (from CharlieProxy)

GET /registration/rest/users/account_get_foto/fdbc2222-7b75-4ff4-b111-623e951e5b00?fotoId=134     HTTP/1.1
Host: -------------:8080
User-Agent: Ferret/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

and here's the response headers, showing a "200 OK"

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet/3.0; JBossAS-6
Content-Type: image/*
Content-Length: 461109
Date: Tue, 31 Jan 2012 21:12:33 GMT

âPNG (png data deleted...)

I'm a little puzzled now. My server is clearly returning the image data, but my app just isn't getting it. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

预谋 2025-01-08 04:23:46

嗯,我找到了。不妨为未来的谷歌用户提供答案。

我的 networkImageView 超出了范围并被 ARC 了。有趣的是,我以为我已经把它保存起来了,但该代码被部分注释掉了!

Well, I found it. Might as well put the answer in for future googlers.

My networkImageView had gone out of scope and was ARC'd. Funny, I thought I had saved it away, but that code was partially commented out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文