[Turn]ios IPC via Nsfilecoordinator and Nsfilepresenter

Source: Internet
Author: User

source:http://mjtsai.com/blog/2014/11/21/ios-ipc-via-nsfilecoordinator-and-nsfilepresenter/

Why every time I think of something that has been researched by others. ⊙﹏⊙ b Khan

Tom Harrington:

There ' s still no full IPC mechanism on IOS.? NSDistributedNotification ? Hasn ' t made the jump from OS X to IOS and probably never would. But file coordination and presentation can serve the same purpose, as long as the apps use the same app group.

When I am adding file coordination and presentation to my Demo app, I realized that they could also is used for Notifi Cations between an app and its extensions. If One of them does a coordinated write while the and the other are using a file presenter for the file, the call Topresenteditemdidchange ? happens almost instantly. The Notification is the whole purpose of the It makes sense it would work this method. I want to is notified if a specific file changes, and that's how I get the notification.

But you don ' t need-care about the file contents to being interested in notifications. If you just want a notification, choose a file name and use it as the notification mechanism. Any time one process needs to notify the other and make a change to the file. The other would get a file presenter call, and the notification are complete. It feels sort of a hack but really this is exactly how the API was designed to work.

Update (2014-11-22):? Apple TN2408? (via?) Janapotheker):

using file coordination in the app extension to access a container gkfx with its contain ing app may result in a deadlock. This was usually the case if a process is suspended mid coordinated I/O. This can is more prevalent on IOS where most apps would be suspended after a short period of time after being moved to the Background. Extensions should use alternatives to file coordination.

[...]

Regardless of this issue, the containing app (and all applications) should properly use background task assertions Arou nd file operations they require completed in a GKFX container (with or without extensions). This includes all writes or deletions. Such a process might still is killed by Jetsam and at a much lower frequency.

?

[Turn]ios IPC via Nsfilecoordinator and Nsfilepresenter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.