菜鸟教程小白 发表于 2022-12-13 06:32:15

ios - AFNetworking 进入后台后继续上传


                                            <p><p>我使用 <code>AFAmazonS3</code>(它是 <code>AFNetworking</code> 的扩展)</p>

<p>它有 <code>AFHTTPRequestOperation</code> 被创建并添加到操作队列中
<code>;</code></p>

<p>问题是,当应用程序进入后台时,它会停止上传,并且在返回时不会恢复。</p>

<p>我怎样才能实现它?
我看到了一些解决方案,但它是针对旧版本的 <code>AFNetworking</code></p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>AFNetworking 支持后台操作。这篇文章提到了 <code>setShouldExecuteAsBackgroundTaskWithExpirationHandler:</code> 并解释了如何使用它<a href="https://stackoverflow.com/a/7881866/3033056" rel="noreferrer noopener nofollow">https://stackoverflow.com/a/7881866/3033056</a> .
该方法在<code>AFURLConnectionOperation</code>中,<code>AFHTTPRequestOperation</code>继承自<code>AFURLConnectionOperation</code> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - AFNetworking 进入后台后继续上传,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/29808389/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/29808389/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - AFNetworking 进入后台后继续上传