NSURLConnection sendSynchronousRequest 稍后不重新加载数据

发布于 2024-10-03 11:44:01 字数 305 浏览 0 评论 0原文

我有一个问题。

我发送 NSURLConnection sendSynchronousRequest 来保存数据,然后导航到下一个视图。下一个视图发送另一个 NSURLConnection sendSynchronousRequest,并加载数据以进行显示。

问题是,当我进行 NSURLConnection sendSynchronousRequest 时,没有收到保存的新数据,但是如果我重新加载第二个视图数据,或者在第二个视图加载数据中设置延迟,则会加载数据。

延迟选项是不好的解决方案。

可以帮我吗?

谢谢。

I have a problem.

I send a NSURLConnection sendSynchronousRequest for save data, and navigate to the next view. The next view send a other NSURLConnection sendSynchronousRequest, and load the data for show.

The problem are that when I make the NSURLConnection sendSynchronousRequest, don't receive the new data saved, but if I reload the second view data, or I put a delay in de second view load data, the data is loaded.

The delay option are bad solution.

Can help me please?

Thanks.

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

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

发布评论

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

评论(1

阳光①夏 2024-10-10 11:44:01

如果我理解正确的话,您正在同步将数据推送到服务器,然后更改视图,然后同步从服务器下载数据,并且您没有取回刚刚保存的数据?在我看来,这是你的服务器的问题。我还建议根本不要使用同步 NSURLConnections,因为任何类型的延迟或服务器问题都会阻塞主线程,但这是一个单独的问题。

If I understand correctly, you're synchronously pushing data to a server, then changing views, then synchronously downloading data from the server, and you're not getting the data back that you just saved? It sounds to me like it's a problem with your server. I'd also suggest not using synchronous NSURLConnections at all, because any sort of latency or server issues will block the main thread, but that's a separate issue.

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