同一iPhone App在不同设备上的数据交换 [英] Data Exchange between same iPhone App on separate devices
问题描述
我正在开发iPhone上的应用程序,该应用程序可以让用户拍照,添加评论和GPS定位并通过电子邮件发送给其他用户。
I am developing an app on iphone that lets user take photos, add comments & GPS location to it and send it as an email to another user.
如果收件人安装了相同的应用程序,当她点击附件时,同一应用程序将启动&解析这些详细信息将它们显示给收件人。 (我打算将UIDocumentInteractionController用于此处的某些内容)
If the recipient has installed the same app & when she clicks on the attachment the same app will launch & parse these details & show them to the recipient. (I intend to use UIDocumentInteractionController for some of the stuff here)
问题:什么是在单个文件中编码此数据的最佳方法? ;然后从电子邮件中获取它。
Problem: whats the best way to encode this data in a single file & then retrive it upon arrival from the email.
推荐答案
这是相当高级的步骤,但这是常规步骤:
This is pretty high level, but here are the general steps:
首先,按照此处。
然后,使用 NSKeyedArchiver 。
接下来,使用 MFMailComposeViewController 。确保提供的文件名与您先前注册的文件类型相匹配。
Next, attach it to an email using MFMailComposeViewController. Make sure you give it a filename that matches the file type you registered earlier.
最后,实现 application:didFinishLaunchingWithOptions:处理用户尝试打开您的电子邮件附件的情况。 (当前,这是方法文档中的第四个项目符号。)
Finally, implement application:didFinishLaunchingWithOptions: to handle the case when a user tries to open your email attachment. (Currently, it's the fourth bullet in the method documentation.)
这篇关于同一iPhone App在不同设备上的数据交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!