我可以在后台运行多路连接会话吗? [英] Can I have a multipeer connectivity session run in the background?

查看:132
本文介绍了我可以在后台运行多路连接会话吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个成功利用多重连接发送消息的应用程序。

目前,当服务器应用移动到后台时,我会拆除会话并重新建立时返回到前景。现在,我需要在后台使服务器应用程序响应(接收消息)。

I have two apps which are successfully utilising multipeer connectivity to send messages.
Currently, when the "server" app moves to the background, I tear down the session and re-establish when returning to the foreground. Now, I need to make the server app responsive (to received messages) while in the background.

通过响应,我的意思是可以接受传入消息,进行处理并向对等方返回确认 - 无需UI。当应用程序返回到前台时,将显示在后台收到的消息。

By being responsive, I mean can accept an incoming message, do the processing and return an acknowledgment to the peer - no UI required. When the App returns to the foreground, the messages received while in the background will be displayed.

我已经在后台通知中禁用了MPC teartown,发现MPC自动断开连接来自会话的服务器 - 所以我的客户对等点看到服务器离线。

I've disabled the MPC teartown on background notification and found that MPC automagically disconnects the "server" from the session - so my "client" peers see the server go offline.


  • 是否可以进行后台多重会话?我认为它是,但似乎找不到任何关于如何启用它的确定性。

  • 我没有开发支持后台处理的应用程序,所以我正在寻找指导支持后台处理的应用程序是否能解决问题

  • 我所看到的支持的背景模式并没有真正与多线程对齐 - 我能找到的最接近的是后台获取 - 这真的很重要吗?

推荐答案

那么,根据Apple Dev论坛的回复,答案是否定的。在后台运行时不支持多路通信。对于有权访问的人,请点击此处链接: Apple Dev Forum

Well, based on responses from the Apple Dev Forums, the answer is NO. Multipeer Communications is not supported while operating in the background. For those with access, link here: Apple Dev Forum

根据苹果文档如果应用程序进入后台,框架将停止广告和浏览并断开任何打开的会话。返回到前台后,框架会自动恢复广告和浏览,但开发人员必须重新建立任何已关闭的会话请参阅: Apple doc

As per apple documentation "If the app moves into the background, the framework stops advertising and browsing and disconnects any open sessions. Upon returning to the foreground, the framework automatically resumes advertising and browsing, but the developer must reestablish any closed sessions" Refer: Apple doc

这篇关于我可以在后台运行多路连接会话吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆