Home  >  Q&A  >  body text

app通信 - ios中app间可以用共享内存通信吗?

同一公司间的app,想通过共享内存通信,我的实现思路是这样的:
1)app间能否共享文件:
调查结果:使用相同证书的app间能够共享文件,比如迅雷
2)使用mmap函数进行内存映射:
调查结果:ios中可以使用mmap系统调用

将共享的文件分别映射到各个app的物理内存中,按道理讲以上两个步骤就能实现内存共享了,请问我的方案是否可行?

PHPzPHPz2759 days ago987

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 17:30:31

    First you need shared files, but does the sandbox allow you to share files?

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:30:31

    Apps can share data through Keychain Sharing.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:30:31

    I have never used shared memory, so I won’t comment.

    Regarding file sharing, I have some suggestions:

    1. Files can be shared using App Group

    2. App Group is stored in an independent space outside the sandbox

    3. If there are multiple apps using the same App Group space, the space content will be cleared only when the last one is deleted

    4. Compared with shared memory, shared files should be safer

    Finally attached is a comprehensible tutorial on data sharing between Extension and Containing App in iOS 8

    Although it is ExtensionContaining Appcommunication in the title, it is actually used for communication between APPs.

    Wish you good luck

    reply
    0
  • Cancelreply