在iOS中跨应用程序共享UDP数据(后台/前景或分屏多任务) [英] Sharing UDP Data across apps (background/foreground or Split screen multitasking) in iOS
问题描述
我正在编写一个研究应用程序,该应用程序利用通过UDP广播数据的特定传感器的优势.有许多使用此传感器的商业应用程序,我们希望能够同时运行我们的应用程序和现有应用程序.
I'm writing a research application that takes advantage of a specific sensor that broadcasts data over UDP. There are various commercial apps that use this sensor and we are hoping to be able to run both our application and an existing application side by side.
过去(iOS 8及更低版本),我们将在后台运行我们的应用程序以记录数据,而在前台运行另一个应用程序.不幸的是,似乎只有一个应用程序能够绑定传入的UDP数据(这很有意义),但是随着即将到来的并排"应用程序功能,我想知道是否有任何解决方案可以在应用程序之间共享数据.
In the past (iOS 8 and below) we would run our application in the background to record data and a different application in the foreground. Unfortunately it appears only a single application was able to bind to the incoming UDP data (which makes sense), however with the coming 'side-by-side' application capabilities I was wondering if there was any solution to share data between the applications.
我唯一能想到的就是让我们的应用程序以某种方式捕获数据并将其重新广播到另一个应用程序中,但是我不知道在iOS中这是否可行,即使您如何将确定谁"对UDP流具有锁定.
The only thing I could think of was to somehow have our app capture the data and re-broadcast it out to the other application but I'm not aware of whether that is possible in iOS, and even if it was how you would determine "who" has a lock on the UDP stream.
Apples文档,位于: https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/index.html#//apple_ref/doc/uid/TP40015145 似乎没有提供太多信息
Apples documentation at: https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/index.html#//apple_ref/doc/uid/TP40015145 doesn't seem to offer much information.
推荐答案
I am not certain of whether or not this will apply to your use-case but you may want to use CloudKit to send data to a custom app container. In the app capabilities section of your second app you can access the shared container.