使用新文档支持 API 进行 iOS 应用程序到应用程序的数据传输
问题:
Building Enterprise Applications of a Suite Nature, and need to be able to pass data from one application to another. Example: App1 is a barcode reader that produces and inventory list. App2 needs a "fresh" copy of the same inventory list information that App1 just produced in order to accomplish its goal of producing purchase orders. The two apps and databases are two large to squeeze together in single app, plus the suite will continue to grow with more and more apps.
理解:
I fully understand that "Each" application is in it's own sandbox. However, in reading through the documents regarding the new UIDocumentInteractionController API, it appears that an application can dip outside of the sandbox just a little to "Read-In", "View", or "Open-In" a document that was not apart of the bundle or created within the application.
数据流:
I'm trying to keep it simple. I have been using the DocInteraction sample application downloaded from Apple, and another application...called App1 to try and work with a simple text file. In App1, I create a simple txt file, and save it to the documents folder. (But this is still inside the app's sandbox?). in the DocInteraction modified sample, I have been trying to figure a way to "View", "Open-In", or better yet "Read-In" the created txt file. If I can pass a simple txt file between the two, I can include a CSV structure to update the databases on each side when ever the applications are opened.
我尝试使用启动选项键,但没有成功。
简而言之,我似乎无法理解:
- App1 的数据需要去哪里?
- 如何查找其他应用程序(例如App2)中的数据?
- 如何“打开”另一个应用程序沙箱中存在的文件?
最终结果: 我试图远离
文档交互文档大纲:
- 预览文档或呈现选项
- 注册您对文件类型的支持
- 从其他应用程序打开文件
- 显示和打印快速查看预览
它是“ >从其他应用程序打开文件”是我最感兴趣的。它指示我通过传入键的字典值来利用 application:didFinishLaunchingWithOptions: 方法。这就是我迷路的地方??如何设置按键以便它知道要查找“何处”和“什么”?而且我仍然不清楚 App1 应该将信息保存到哪个正确的目录以便让键指向正确的位置?
打开电子邮件文件附件和在 iBooks 中打开 pdf 并不是您可以使用此 API 的唯一地方,否则 Apple 不会完成所有工作,他们已经允许从应用程序进行对话 -到应用程序。
Note: I'm not trying to get App1 to directly transmit data into App2's files. I don't think that would be allowed by Apple at all! I'm trying to get App1 to zip up its data, save it in proper location, so when user decides to use App2, the data can then be available to App2 by "reading-in" the data.
如果有人有示例应用程序、教程,或者甚至是如何使其工作的可靠想法,我将非常感谢您的帮助。
-谢谢!
PS 拥有 1,500 或更高声誉的人请为 stackoverflow 创建一个“UIDocumentInteraction”标签!
Problem:
Building Enterprise Applications of a Suite Nature, and need to be able to pass data from one application to another. Example: App1 is a barcode reader that produces and inventory list. App2 needs a "fresh" copy of the same inventory list information that App1 just produced in order to accomplish its goal of producing purchase orders. The two apps and databases are two large to squeeze together in single app, plus the suite will continue to grow with more and more apps.
Understanding:
I fully understand that "Each" application is in it's own sandbox. However, in reading through the documents regarding the new UIDocumentInteractionController API, it appears that an application can dip outside of the sandbox just a little to "Read-In", "View", or "Open-In" a document that was not apart of the bundle or created within the application.
Data Flow:
I'm trying to keep it simple. I have been using the DocInteraction sample application downloaded from Apple, and another application...called App1 to try and work with a simple text file. In App1, I create a simple txt file, and save it to the documents folder. (But this is still inside the app's sandbox?). in the DocInteraction modified sample, I have been trying to figure a way to "View", "Open-In", or better yet "Read-In" the created txt file. If I can pass a simple txt file between the two, I can include a CSV structure to update the databases on each side when ever the applications are opened.
I have tried to utilize the Launch Options Keys with no luck.
In short, I just can't seem to get my head around:
- Where App1's data needs to go?
- How to find the data in the other App, say App2?
- How do you "Open" the file that exist inside another application's sandbox?
End Result:
I have tried to stay away from the
The Document Interaction docs outline:
- Previewing a Document or Presenting Options
- Registering Your Support of File Types
- Opening Files From Other Apps
- Displaying and Printing Quick Look Previews
It is the "Opening Files From Other Apps" that I am most interested with. It directs me to utilize the application:didFinishLaunchingWithOptions: method by passing in dictionary values for the keys. This is where I get lost?? How do I set the keys so that it knows "WHERE" and "WHAT" to look for? And I'm still not clear the proper director that App1 should be saving information to in order for the keys to point to the correct place?
Opening email file attachments and opening pdfs in iBooks can't be the only places where you can utilize this API or else Apple wouldn't have went through all the work, they are already allow to talk from App-To-App.
Note: I'm not trying to get App1 to directly transmit data into App2's files. I don't think that would be allowed by Apple at all! I'm trying to get App1 to zip up its data, save it in proper location, so when user decides to use App2, the data can then be available to App2 by "reading-in" the data.
If someone has a sample application, tutorial, or even a solid idea how to get this working I would really appreciate the help.
-Thanks!
P.S. Somebody with 1,500 or higher reputation please create a "UIDocumentInteraction" tag for stackoverflow!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我上个月就开始工作了。这是我的思维模型:
App1 在其沙箱中的任何位置创建一个文件。
App1 调用 docinteraction 以显示该文件的“打开方式”GUI
用户选择“在 App2 中打开”
iOS 将文件从一个沙箱复制到另一个沙箱并启动 App2。
App2 实现 didfinishlaunchingwithURL 并加载提供的 URL(这是其沙箱中的副本)
I got it working last month. Here's my mental model:
App1 creates a file anywhere in its sandbox.
App1 calls docinteraction to display the "Open In" GUI for that file
User picks "Open in App2"
The iOS copies the file from one sandbox to the other and launches App2.
App2 implements didfinishlaunchingwithURL and loads the supplied URL (which is the copy in its sandbox)