About Incorporating iCloud Into Your App

关于结合iCloud到你的应用About Incorporating iCloud Into Your App

iCloud是一个免费服务,用户可以访问它们的个人内容到所有设备——通过你的苹果账号(无线的,自动的)。iCloud通过结合基于网络的存储和专用的API,通过操作系统支持全面整合。苹果提供服务基础设施,备份和用户账号,这样你可以聚焦到建设可以支持iCloud的应用开发上。iCloud is a free service that lets users access their personal content on all their devices—wirelessly and automatically via Apple ID. iCloud does this by combining network-based storage with dedicated APIs, supported by full integration with the operating system. Apple provides server infrastructure, backup, and user accounts, so you can focus on building great iCloud-enabled apps.

About Incorporating iCloud Into Your App_第1张图片

你的iCloud背后的核心理念是排除设备间的显性的同步。一个用户从不需要考虑同步,你的应用也不用直接与iCloud服务器交互。当你采用iCloud存储API时,就像文件中描述的,自动改变所有连接到云账号设备上的显示。你的用户会得到安全、连续和透明的访问个人所有内容。The core idea behind iCloud is to eliminate explicit synchronization between devices. A user never needs to think about syncing and your app never interacts directly with iCloud servers. When you adopt iCloud storage APIs as described in this document, changes appear automatically on all the devices attached to an iCloud account. Your users get safe, consistent, and transparent access to their personal content everywhere.

 

概览At a Glance

iCloud是所有有关的内容,这样你的整合工作就可以集中到应用的模型层。因为你的应用程序的实例运行在用户的其他设备上,可以改变本地应用实例的数据模型,你设计应用程序来解决这样的改变。你也可能需要改变用户接口,呈现基于iCloud的文件和信息。iCloud is all about content, so your integration effort focuses on the model layer of your app. Because instances of your app running on a user’s other devices can change the local app instance’s data model, you design your app to handle such changes. You might also need to modify the user interface for presenting iCloud-based files and information.

有一个重要的情况是Cocoa 适应 iCloud。一个基于文件的OS X v10.8及以后版本的应用需要很少 iCloud 适配工作,谢谢NSDocument 类提供的功能。There is one important case for which Cocoa adopts iCloud for you. A document-based app for OS X v10.8 or later requires very little iCloud adoption work, thanks to the capabilities of the NSDocument class.

有多种不同方式使用 iCloud 存储,一系列的技术可以访问它。这个文件介绍了所有 iCloud 存储 APIs,并提供如何在 iCloud 上下文中设计应用的指导。There are many different ways you can use iCloud storage, and a variety of technologies available to access it. This document introduces all the iCloud storage APIs and offers guidance in how to design your app in the context of iCloud.

 

iCloud支持用户工作流程iCloud Supports User Workflows

在你的应用中采用 iCloud可以让你的用户在一个设备上开启工作流,并在另一个设备结束工作流。 Adopting iCloud in your app lets your users begin a workflow on one device and finish it on another.

说你提供一个播客应用。一个通勤订阅到一个他iPhone的播客,并在去工作的路上的前二十分钟听到。在这个办公区,他从iPad启动你的应用。这段插曲自动下载,而且是从断点开始继续播放。Say you provide a podcast app. A commuter subscribes to a podcast on his iPhone and listens to the first twenty minutes on his way to work. At the office, he launches your app on his iPad. The episode automatically downloads and the play head advances to the point he was listening to.

或者说,你为iOS和Mac OS提供一个画布应用。在一个早上,一个建筑工程师在拜访客户时在iPad上画了草图。在返回工作室的路上,她在Mac上启动你的应用。所有新的草图已经存在了,等待你打开,并继续工作。Or say you provide a drawing app for iOS and OS X. In the morning, an architect creates some sketches on her iPad while visiting a client. On returning to her studio, she launches your app on her iMac. All the new sketches are already there, waiting to be opened and worked on.

为了给存储播客应用的信息在iCloud,你应该用键值存储。要存储建筑草图到iCloud,你要用到iCloud文件存储。To store state information for the podcast app in iCloud, you’d use iCloud key-value storage. To store the architectural drawings in iCloud, you’d use iCloud document storage.


相关章节:“iCloud基础”Relevant Chapter: “iCloud Fundamentals”

 

iCloud中三种存储方式Three Kinds of iCloud Storage

iCloud支持三种存储方式。如何为你的应用选择最适合的一种,或者结合多种方式,确保你理解了每种方式的意图和功能。iCloud supports three kinds of storage. To pick the right one (or combination) for your app, make sure you understand the intent and capabilities of each. The three kinds of iCloud storage are:

  • 键值存储Key-value storage 存储离散值,例如偏好、设置、简单的应用程序状态。for discrete values, such as preferences, settings, and simple app state.

  • 文件存储Document storage 存储用户可见的基于文件的信息,例如文字程序文件、绘图、混合应用状态。for user-visible file-based information such as word processing documents, drawings, and complex app state.

  • 核心数据存储Core Data storage 为结构化内容存储鞋盒类型的应用和基于服务器、多设备数据库解决办法。iCloud核心数据是创建在文档存储上的,并且用了相同的iCloud APIs。for shoebox-style apps and server-based, multi-device database solutions for structured content. iCloud Core Data storage is built on document storage and employs the same iCloud APIs.


相关章节:“在iCloud中设计键值数据”“在iCloud中设计文档”“在iCloud中设计核心数据”Relevant Chapters: “Designing for Key-Value Data in iCloud,” “Designing for Documents in iCloud,” “Designing for Core Data in iCloud”

 

iCloud配置和权限的准备Prepare for iCloud with Provisioning and Entitlements

采用iCloud的前两个步骤你的应用程序获得一个适当的配置概要文件为您的开发设备和要求适当的权利在你的Xcode项目。The first two steps in adopting iCloud for your app are to obtain an appropriate provisioning profile for your development device and to request the appropriate entitlements in your Xcode project.


注意Note: iCloud权限是只有应用提交到App Store或Mac App Store是可用的。iCloud entitlements are available only to apps submitted to the App Store or to the Mac App Store.

权限是键值对,需要为你的应用设置适当的值,例如使用iCloud的能力/性能/容量。你的iCloud权限值定义了你的应用可以把诗句放在什么地方,他们确保只有你的应用允许访问这些数据。你请求单独授权文件存储和键值存储。当你签署你的应用程序代码,这些请求变成你的应用程序代码签名的一部分。Entitlements are key-value pairs that request capabilities for your app—such as the capability to use iCloud. Your iCloud entitlement values define where your app can place data and they ensure that only your apps are allowed to access that data. You request separate entitlements for document storage and key-value storage. When you code sign your app, these requests become part of your app’s code signature.


相关单元:“首先,提供你的开发设备”“通过使用权利,请求访问iCloud存储”Relevant Sections: “First, Provision Your Development Devices,” “Request Access to iCloud Storage By Using Entitlements”

 

如何运用这个文档How to Use This Document

是否你是开发iOS、OS、或者两者都有,无论哪个应用排序你在开发,从阅读 “iCloud Fundamentals” 开始,里面会讲到得到所有iCloud开发者需要的基础。Whether you are developing for iOS, OS X, or both, and no matter which sort of app you are developing, start by reading the entire “iCloud Fundamentals” chapter to get the foundation that all iCloud developers need.

接下来,查看“Designing for Key-Value Data in iCloud”。任何应用,提供用户设置或维护用户状态,接近每个应用,应该适应iCloud键值存储。Next, read “Designing for Key-Value Data in iCloud.” Any app that provides user settings or maintains user state—that is, nearly every app—should adopt iCloud key-value storage.

iOS和OS文件体系结构,自动为基于文件的应用提供iCloud需要的功能。如果你的应用使用基于文件的信息,查看 “Designing for Documents in iCloud.” The iOS and OS X document architectures automatically provide most of the iCloud functionality needed by document-based apps. If your app works with file-based information, you’ll want to read “Designing for Documents in iCloud.”

如果你在开发一个核心数据应用,阅读“Designing for Core Data in iCloud” 为一个iCloud核心数据注意事项概要。If you are developing a Core Data app, read “Designing for Core Data in iCloud” for an overview of iCloud considerations for Core Data.

不论采用哪种iCloud存储 APIs,测试是至关重要的。为你的应用开始创建一个测试计划,阅读“Testing and Debugging Your iCloud App.” No matter which iCloud storage APIs you adopt in your app, testing is critical. To get started on creating a test plan for your app, read “Testing and Debugging Your iCloud App.”


查看See Also

这个文档只是描述了一些关于应用的iCloud支持,但是没有应用开发方面的指导。这方面的指导可以查看如下文档:This document describes the pieces you need to support iCloud in your app, but does not teach you how to develop apps. For that, start with Start Developing iOS Apps Today or Start Developing Mac Apps Today, and read the following documents:

  • iOS应用iOS apps: iOS App Programming Guide

  • Mac应用Mac apps: Mac App Programming Guide

如果你计划用iCloud的核心数据,查看在Core Data Programming Guide中的技术,还要读一下Using Core Data with iCloud Programming NotesIf you plan to use Core Data with iCloud, learn about this technology in Core Data Programming Guide and be sure to read Using Core Data with iCloud Programming Notes.

实现基于文档的iCloud应用的入门教程,阅读Your Third iOS App: iCloud。For a tutorial introduction to implementing a document-based iCloud app for iOS, read Your Third iOS App: iCloud.

转载于:https://www.cnblogs.com/zyingn/articles/iOS_translation8.html

你可能感兴趣的:(移动开发,xcode,开发工具)