今天,扩展和背景音乐(Today Extension and background audio)

2019-10-20 14:18发布

我试图做的iOS 8事情简单的播客类部件工作正常,音频作品......除了在屏幕睡眠,音频停止时。

如今扩展可以做背景音乐? 或一般的多任务?

Answer 1:

No. Today Widget is destroyed when it goes out of view (as evidenced by viewDidDisappear).. so sound can only be enabled when the widget is physically in view.

Edit: Nope it is linked to the host app that runs it. As detailed in Apple documentation, an extension is a specialized binary that is delivered through a containing app. The containing app is only used for delivery and the extension runs independently of it. This notwithstanding, an iOS containing app is required to effectively provide some functionality in addition to the extension. On OS X such requirement is relaxed and a containing app is not required to provide any additional functionality.

As mentioned, an extension life cycle is completely unrelated to its containing app's and it comprises 4 steps:

User chooses an app extension. System launches it. App extension runs. System kills app extension.

http://www.infoq.com/news/2014/07/apple-ios8-app-extensions



Answer 2:

作为@ktzhang提到,背景音乐是​​不可扩展。

然而,一些有限的多任务是可能的,该文件说你“可以设置一个背景网址上传或下载任务”中的延伸。



文章来源: Today Extension and background audio