iOS Developer Library/Guides

Providing Purchased Content, iOS In-App Purchase Programming Guide 번역

창업자닉군 2013. 9. 19. 09:50

Introduction | Designing Your App’s Store | Displaying Your App’s Store UI | Requesting Payment
Delivering Products | Providing Purchased Content | Working with Subscriptions | Preparing for App Review

본 페이지는 iOS In-App Purchase Programming Guide 문서의 Providing Purchased Content 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.




Providing Purchased Content
구입 한 콘텐츠를 제공

There are several approaches for delivering content: You can include content in your app bundle, download content from your own server, or download content from Apple’s servers. There is a design tradeoff between the competing desires to make content available to the user as quickly as possible after it is purchased, and the desire to keep the initial download size of the app small. If you include too little in your app bundle, the user must wait for even small purchases to download. If you include too much in your app bundle, the initial download of the app takes much longer, the space is wasted for users who don’t purchase the corresponding products, and, if the app becomes larger than 50 megabytes, users won’t be able to download it over a cellular network.

내용을 전달하기위한 몇 가지 방법이 있습니다 : 당신은 당신의 애플 리케이션 번들의 내용을 포함 할 수 있습니다, ​​자신의 서버에서 콘텐츠를 다운로드하거나 애플의 서버에서 콘텐츠를 다운로드 할 수 있습니다. 은 구입 후 가능한 빨리 사용자가 콘텐츠를 사용할 수 있도록 경쟁 욕망 사이의 디자인 트레이드 오프, 소규모 응용 프로그램의 초기 다운로드 크기를 유지하는 욕망이 있습니다. 당신은 당신의 애플 리케이션 번들 너무 적게 포함하는 경우도 작은 구매를 다운로드하려면, 사용자는 기다려야합니다. 당신은 당신의 애플 리케이션 번들에 너무 많이 포함하는 경우, 응용 프로그램의 초기 다운로드 시간이 더 오래 걸립니다 공간이 해당 제품을 구매하지 않는 사용자를 위해 낭비되고, 응용 프로그램이 50메가바이트보다 큰 될 경우, 사용자는하지 않습니다셀룰러 네트워크를 통해 다운로드 할 수 있습니다.

Embed small files (up to a few megabytes) in your app, especially if you expect most users to buy that product. This lets you make the purchased content available immediately. To add or update content in your app bundle, you have to submit an updated version of your app.

당신은 대부분의 사용자가 해당 제품을 구입하기 위해 기대 특히, 당신의 애플 리케이션에 작은 파일 (최대 몇 메가 바이트에) 포함. 이것은 당신이 바로 구입 한 콘텐츠를 사용할 수 있도록 할 수 있습니다. 귀하의 응용 프로그램 번들에 컨텐츠를 추가하거나 업데이트하려면, 당신은 귀하의 응용 프로그램의 업데이트 된 버전을 제출해야합니다.

Host larger files on a server and download them when needed. You can add or update hosted content without needing to submit an updated version of your app (assuming your app uses a dynamic list of products). You can use hosted content associated with a free non-consumable purchase to deliver additional content while keeping your app’s initial download small. For example, a game can include the first level it its app bundle and let users download the rest of the levels for free from Apple’s servers.

서버에 큰 파일을 호스팅하고 필요할 때 다운로드 할 수 있습니다. 당신은 응용 프로그램의 업데이트 된 버전 (응용 제품의 동적 목록을 사용하는 가정)을 제출하지 않고 호스팅 내용을 추가하거나 업데이트 할 수 있습니다. 당신은 응용 프로그램의 초기 다운로드를 작게 유지하면서 추가 콘텐츠를 제공하는 무료 비 소모품의 구입에 관련된 호스팅 콘텐츠를 사용할 수 있습니다. 예를 들어, 게임은 첫 번째 수준의 그것에게 그것의 응용 프로그램 번들을 포함하고 사용자가 애플의 서버에서 무료로 수준의 나머지 부분을 다운로드하도록 할 수 있습니다.

When you host content on Apple’s servers you don’t need to worry about the server infrastructure. It is built on the same infrastructure that supports other large-scale operations, such as the iTunes Store, so your app can depend on it to be robust and scalable. Hosted content automatically downloads in the background even if your app isn’t running.

당신이 애플의 서버에서 콘텐츠를 호스팅 할 때 서버 인프라에 대해 걱정할 필요가 없습니다. 이 같은 아이튠즈 스토어와 같은 다른 대규모 작업을 지원하는 동일한 인프라를 구축하므로 응용 프로그램은 강력하고 확장 할에 의존 할 수 있습니다. 앱이 실행되지 않은 경우에도 콘텐츠를 자동으로 호스팅은 백그라운드에서 다운로드합니다.

When restoring transactions, let the user control what content gets downloaded, as described in Restoring Transactions.

트랜잭션을 복원 할 때, 트랜잭션 복원에 설명 된대로 어떤 내용이 다운로드되는 사용자 정의 컨트롤을 할 수 있습니다.

Unlocking Local Content
로컬 콘텐츠를 잠금 해제

To unlock local content after the user purchases it, load it using the NSBundle class, just as you load other resources from your app bundle.

사용자가 구입 한 후 로컬 콘텐츠의 잠금을 해제하려면, 당신은 당신의 애플 리케이션 번들에서 다른 리소스를로드하는 것처럼 NSBundle 클래스를 사용하여 그것을로드합니다.

NSURL * url = [[NSBundle mainBundle] URLForResource:@"rocket"
                                      withExtension:@"plist"];
[self loadCarAtURL:url];

Downloading Hosted Content from Apple’s Server
애플의 서버에서 호스팅 콘텐츠를 다운로드

When the user purchases a product that has associated hosted content, the transaction passed to your transaction queue observer also includes an instance ofSKDownload which lets you download the content.

사용자가 콘텐츠를 호스팅 관련있는 제품을 구입하는 경우, 트랜잭션 큐 관찰자에게 전달 된 트랜잭션은 또한 콘텐츠를 다운로드 할 수 있습니다 인스턴스 ofSKDownload가 포함되어 있습니다.

To download the hosted content, add the download objects from the transaction’s downloads property to the transaction queue by calling the startDownloads:method of SKPaymentQueue. If the value of the downloads property is nil, there is no hosted content for that transaction. Unlike downloading apps, downloading hosted content does not automatically require a Wifi connection for content larger than a certain size. Avoid using cellular networks to download large files without an explicit action from user.

SKPaymentQueue의 방법 : 호스팅 콘텐츠를 다운로드하려면 startDownloads를 호출하여 트랜잭션의 다운로드 속성에서 트랜잭션 큐에 다운로드 개체를 추가합니다.다운로드 속성의 값이 nil이 경우 해당 거래에 대한 호스팅 내용이 없습니다. , 응용 프로그램을 다운로드 호스팅 콘텐츠를 다운로드 달리 자동으로 특정 크기보다 큰 콘텐츠에 대한 WiFi 연결이 필요하지 않습니다. 사용자의 명시 적 조치없이 대용량 파일을 다운로드하는 셀룰러 네트워크를 사용하지 마십시오.

Implement the paymentQueue:updatedDownloads: method on the transaction queue observer to respond to changes in a download’s state—for example, by updating progress in your UI or by notifying the user of a failed download.

변화에 대응하기 위해 트랜잭션 큐 관찰자에 방법 다운로드의 상태 예를 들어, 귀하의 UI에서 진행 상황을 업데이트하거나 실패한 다운로드의 사용자에게 알리지 기준 : updatedDownloads : paymentQueue를 구현합니다.

Update your user interface while the content is downloading using the values of the progress and timeRemaining properties. You can use the pauseDownloads:,resumeDownloads:, and cancelDownloads: methods of SKPaymentQueue from your UI to let the user control in-progress downloads. Use the downloadStateproperty to determine whether the download has completed. Don’t use the progress or time remaining, these properties wouldn’t let your app accurately tell the difference between downloads that are almost finished and downloads that are completely finished.

내용이 진보와 timeRemaining 속성의 값을 사용하여 다운로드하는 동안 사용자 인터페이스를 업데이트합니다.사용자 정의 컨트롤에서 진행중인 다운로드를하도록 귀하의 UI에서 SKPaymentQueue의 방법 : resumeDownloads : 그리고 cancelDownloads 당신은 pauseDownloads을 사용할 수 있습니다.다운로드가 완료되었는지 여부를 확인하기 위해 downloadStateproperty를 사용합니다. 나머지 진행 또는 시간을 사용하지 마십시오, 이러한 속성은 응용 프로그램이 정확하게 거의 완료 다운로드 완전히 완료 다운로드의 차이를 알려주지 않을 것입니다.

After the download finishes, use its contentURL property to locate the content.
다운로드가 완료된 후, 내용을 찾을 수는 contentURL 속성을 사용합니다.

Downloading Content from Your Own Server
자신의 서버에서 콘텐츠를 다운로드

As with all other interactions between your app and your server, the details and mechanics of this process are up to you. The communication consists of, at minimum, the following steps:

귀하의 응용 프로그램과 서버 사이의 모든 상호 작용과 마찬가지로,이 프로세스의 세부 사항 및 역학 당신에게 달려 있습니다.통신은 최소한 다음 단계에서 구성

  1. Your app sends the receipt to your server and requests the content.
    당신의 앱은 영수증을 서버에 보내고 컨텐츠를 요청합니다.

  2. Your server validates the receipt to establish that the content has been purchased, as described in Receipt Validation Programming Guide.
    서버는 수신 유효성 검사 프로그래밍 가이드에 설명 된대로 콘텐츠가 구입 한 것을 입증하는 영수증을 확인합니다.

  3. Assuming the receipt is valid, your server responds to your app with the content.
    영수증을 가정하는 것은 유효하다, 서버가 콘텐츠를 귀하의 응용 프로그램에 응답합니다.

Consider the security implications of how you host your content and of how your app communicates with your server. For more information, see Security Overview.

당신의 콘텐츠를 호스팅하는 방법과 응용 프로그램이 서버와 통신하는 방법의 보안에 미치는 영향을 고려하십시오. 자세한 내용은 보안 개요를 참조하십시오.

Locating and Managing Downloaded Content
다운로드 된 콘텐츠를 찾기 및 관리

In iOS, your app can manage hosted content after the files are downloaded. The files are saved for you by the Store Kit framework in the Caches directory with the backup flag unset. In most cases, this is the correct behavior—because downloaded content can be re-downloaded, it can be deleted if the user becomes low on disk space (and later restored when disk space becomes available), and it should not be included in the user’s backups. If your app’s downloaded content should not be purgeable, move it to another location. If it should be included in the user’s backup, set the backup flag.

파일을 다운로드 한 후 IOS, 당신의 응용 프로그램은 호스팅 콘텐츠를 관리 할 수 ​​있습니다.파일은 백업 플래그 해제와 캐시 디렉토리에 저장 키트 프레임 워크가 당신을 위해 저장됩니다. 대부분의 경우,이 - 행동 때문에 올바른 다운로드 된 콘텐츠를 다시 다운로드 할 수있는 사용자의 디스크 여유 공간 (디스크 공간을 사용할 수있게되면 나중에 복원)에 낮은 경우, 그것은 삭제 될 수 있으며, 그것은에 포함되어서는 안 사용자의 백업. 앱의 다운로드 된 콘텐츠가 불려 나가지하지 않아야하는 경우, 다른 위치로 이동합니다. 그것은 사용자의 백업에 포함해야하는 경우, 백업 플래그를 설정합니다.

In OS X, hosted content is saved and managed by the system; your app can’t move or delete the files directly. To locate the file after downloading the content, use the contentURL property of the download object. To locate the file on subsequent launches, use the contentURLForProductID: class method of SKDownload. To delete a file, use the deleteContentForProductID: class method. For information about reading the product identifiers from your app’s receipt, see Receipt Validation Programming Guide.

OS X에서 호스팅되는 콘텐츠는 시스템에 의해 저장 및 관리하고, 당신의 응용 프로그램은 파일을 직접 이동하거나 삭제할 수 없습니다.콘텐츠를 다운로드 한 후 파일을 찾으려면, 다운로드 개체의 contentURL 속성을 사용합니다. 후속 실행에있는 파일을 찾으려면 contentURLForProductID를 사용 SKDownload의 수업 방식입니다.파일을 삭제하려면, deleteContentForProductID을 사용하여 클래스의 메서드를. 앱의 영수증에서 제품 ID를 읽기에 대한 자세한 내용은 영수증 유효성 검사 프로그래밍 가이드를 참조하십시오.