IntorductionAbout Threaded ProgrammingThread ManagementRun Loops
SynchronizationThread Safety SummaryGlossary

본 페이지는 Threading Programming Guide 문서의 Intorduction 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.


Introduction
소개

Threads are one of several technologies that make it possible to execute multiple code paths concurrently inside a single application. Although newer technologies such as operation objects and Grand Central Dispatch (GCD) provide a more modern and efficient infrastructure for implementing concurrency, OS X and iOS also provide interfaces for creating and managing threads.

스레드는 하나의 응용 프로그램 내에서 동시에 여러 개의 코드 경로를 실행하는 것이 가능하게 몇 가지 기술 중 하나입니다. 이러한 작업 개체 및 그랜드 센트럴 디스패치 (GCD)와 같은 새로운 기술은 동시성을 구현하기위한보다 현대적이고 효율적인 인프라를 제공하지만, OS X 및 IOS는 스레드를 만들고 관리하기위한 인터페이스를 제공합니다.

This document provides an introduction to the thread packages available in OS X and shows you how to use them. This document also describes the relevant technologies provided to support threading and the synchronization of multithreaded code inside your application.

이 문서는 OS X에서 사용할 수있는 스레드 패키지에 대한 소개를 제공하고, 당신이 그들을 사용하는 방법을 보여줍니다. 이 문서는 스레딩 및 응용 프로그램 내에서 멀티 스레드 코드의 동기화를 지원하기 위해 제공 관련 기술을 설명합니다.

Organization of This Document
이 문서의 구성

This document has the following chapters and appendixes:
이 문서는 다음 장과 부록이있다 :

  • “About Threaded Programming” introduces the concept of threads and their role in application design.
    의 "스레드 프로그래밍"스레드 응용 프로그램 디자인에서의 역할의 개념을 소개합니다.

  • “Thread Management” provides information about the threading technologies in OS X and how you use them.
    "스레드 관리"스레딩 OS X의 기술과 방법을 당신이 그들을 사용에 대한 정보를 제공합니다.

  • “Run Loops” provides information about how to manage event-processing loops in secondary threads.
    "루프 실행"보조 스레드에서 이벤트 처리 루프를 관리하는 방법에 대한 정보를 제공합니다.

  • “Synchronization” describes synchronization issues and the tools you use to prevent multiple threads from corrupting data or crashing your program.
    "동기화"동기화 문제와 데이터를 손상 시키거나 프로그램을 충돌에서 여러 스레드를 방지하기 위해 사용하는 도구에 대해 설명합니다.

  • “Thread Safety Summary” provides a high-level summary of the inherent thread safety of OS X and iOS and some of their key frameworks.
    "스레드 안전 요약"고유의 스레드 OS X 및 IOS의 안전과 자신의 핵심 프레임 워크의 일부 높은 수준의 개요를 제공합니다.

See Also

For information about the alternatives to threads, see Concurrency Programming Guide.
스레드 대안에 대한 자세한 내용은 동시성 프로그래밍 가이드를 참조하십시오.

This document provides only a light coverage of the use of the POSIX threads API. For more information about the available POSIX thread routines, see the pthreadman page. For a more in-depth explanation of POSIX threads and their usage, see Programming with POSIX Threads by David R. Butenhof.

이 문서는 POSIX 스레드 API의 사용 만 빛 범위를 제공합니다. 사용 가능한 POSIX 쓰레드 루틴에 대한 자세한 내용은 pthreadman 페이지를 참조하십시오. POSIX 스레드와 그 사용에 대한보다 깊이있는 설명은 데이비드 R. Butenhof하여 POSIX 쓰레드로 프로그래밍을 참조하십시오.

Posted by 창업자닉군
,

Intorduction | Validating Receipts Locally | Validating Receipts With the App Store | Receipt Fields

본 페이지는 About Receipt Validation 문서의 Receipt Fields 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.


Receipt Fields
영수증 필드

Receipts are made up of a number of fields. Some fields are only available locally, in the ANS.1 form of the receipt, or only when validating with the App Store, in the JSON form of the receipt. Keys not documented below are reserved for use by Apple and must be ignored by your app.

영수증 필드의 숫자로 구성되어 있습니다. 영수증의 JSON 형태로, 앱 스토어와 유효성을 검사 할 때 일부 필드는 영수증의 ANS.1 형태로 로컬에서만 사용할 수 있습니다, ​​또는. 아래의 문서화되지 않은 키는 애플 용으로 예약되어 있으므로 사용자 응용 프로그램에 의해 무시되어야한다.

App Receipt Fields

Bundle Identifier

The app’s bundle identifier.

ASN.1 Field Type 2

ASN.1 Field Value UTF8STRING

JSON Field Name bundle_id

JSON Field Value string

This corresponds to the value of CFBundleIdentifier in the Info.plist file.

App Version

The app’s version number.

ASN.1 Field Type 3

ASN.1 Field Value UTF8STRING

JSON Field Name application_version

JSON Field Value string

This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in OS X) in the Info.plist.

Opaque Value

An opaque value used as part of the SHA-1 hash.

ASN.1 Field Type 4

ASN.1 Field Value A series of bytes

JSON Field Name (none)

JSON Field Value (none)

SHA-1 Hash

A SHA-1 hash, used to validate the receipt.

ASN.1 Field Type 5

ASN.1 Field Value 20-byte SHA-1 digest

JSON Field Name (none)

JSON Field Value (none)

In-App Purchase Receipt

The receipt for an in-app purchase.

ASN.1 Field Type 17

ASN.1 Field Value SET of in-app purchase receipt attributes

JSON Field Name in_app

JSON Field Value array of in-app purchase receipts

In the JSON file, the value of this key is an array containing all in-app purchase receipts. In the ASN.1 file, there are multiple fields that all have type 17, each of which contains a single in-app purchase receipt.

Original Application Version

The version of the app that was originally purchased.

ASN.1 Field Type 19

ASN.1 Field Value UTF8STRING

JSON Field Name original_application_version

JSON Field Value string

This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in OS X) in the Info.plist file when the purchase was originally made.

In the sandbox environment, the value of this field is always “1.0”.

Receipt Expiration Date

The date that the app receipt expires.

ASN.1 Field Type 21

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name expiration_date

JSON Field Value IA5STRING, interpreted as an RFC 3339 date

This key is present only for apps purchased through the Volume Purchase Program. If this key is not present, the receipt does not expire.

When validating a receipt, compare this date to the current date to determine whether the receipt is expired. Do not try to use this date to calculate any other information, such as the time remaining before expiration.

In-App Purchase Receipt Fields

Quantity

The number of items purchased.

ASN.1 Field Type 1701

ASN.1 Field Value INTEGER

JSON Field Name quantity

JSON Field Value string, interpreted as an integer

This value corresponds to the quantity property of the SKPayment object stored in the transaction’s payment property.

Product Identifier

The product identifier of the item that was purchased.

ASN.1 Field Type 1702

ASN.1 Field Value UTF8STRING

JSON Field Name product_id

JSON Field Value string

This value corresponds to the productIdentifier property of the SKPayment object stored in the transaction’s payment property.

Transaction Identifier

The transaction identifier of the item that was purchased.

ASN.1 Field Type 1703

ASN.1 Field Value UTF8STRING

JSON Field Name transaction_id

JSON Field Value string

This value corresponds to the transaction’s transactionIdentifier property.

Original Transaction Identifier

For a transaction that restores a previous transaction, the transaction identifier of the original transaction. Otherwise, identical to the transaction identifier.

ASN.1 Field Type 1705

ASN.1 Field Value UTF8STRING

JSON Field Name original_transaction_id

JSON Field Value string

This value corresponds to the original transaction’s transactionIdentifier property.

All receipts in a chain of renewals for an auto-renewable subscription have the same value for this field.

Purchase Date

The date and time that the item was purchased.

ASN.1 Field Type 1704

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name purchase_date

JSON Field Value string, interpreted as an RFC 3339 date

This value corresponds to the transaction’s transactionDate property.

For a transaction that restores a previous transaction, the purchase date is the date of the restoration. Use “Original Purchase Date” to get the date of the original transaction.

In an auto-renewable subscription receipt, this is always the date when the subscription was purchased or renewed, regardles of whether the transaction has been restored.

Original Purchase Date

For a transaction that restores a previous transaction, the date of the original transaction.

ASN.1 Field Type 1706

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name original_purchase_date

JSON Field Value string, interpreted as an RFC 3339 date

This value corresponds to the original transaction’s transactionDate property.

In an auto-renewable subscription receipt, this indicates the beginning of the subscription period, even if the subscription has been renewed.

Subscription Expiration Date

The expiration date for the subscription, expressed as the number of milliseconds since January 1, 1970, 00:00:00 GMT.

ASN.1 Field Type 1708

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name expires_date

JSON Field Value number

This key is only present for auto-renewable subscription receipts.

Cancellation Date

For a transaction that was canceled by Apple customer support, the time and date of the cancellation.

ASN.1 Field Type 1712

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name cancellation_date

JSON Field Value string, interpreted as an RFC 3339 date

App Item ID

A string that the App Store uses to uniquely identify the application that created the transaction.

ASN.1 Field Type (none)

ASN.1 Field Value (none)

JSON Field Name app_item_id

JSON Field Value string

If your server supports multiple applications, you can use this value to differentiate between them.

Apps are assigned an identifier only in the production environment, so this key is not present for receipts created in the test environment.

This field is not present for Mac apps.

See also “Bundle Identifier.”

External Version Identifier

An arbitrary number that uniquely identifies a revision of your application.

ASN.1 Field Type (none)

ASN.1 Field Value (none)

JSON Field Name version_external_identifier

JSON Field Value string

This key is not present for receipts created in the test environment.

Web Order Line Item ID

The primary key for identifying subscription purchases.

ASN.1 Field Type 1711

ASN.1 Field Value INTEGER

JSON Field Name web_order_line_item_id

JSON Field Value string

Posted by 창업자닉군
,

Intorduction | Validating Receipts Locally | Validating Receipts With the App Store | Receipt Fields

본 페이지는 About Receipt Validation 문서의 Validating Receipts With the App Store 부분을 번역해 놓은 페이지 입니다. 발 번역이라 이상한 부분이 있을 수 있습니다. 발견즉시 댓글을 달아 주세요.


Validating Receipts With the App Store
앱 스토어와 유효성 검사 영수증


Use a trusted server to communicate with the App Store. Using your own server lets you design your app to recognize and trust only your server, and lets you ensure that your server connects with the App Store server. It is not possible to build a trusted connection between a users device and the App store directly because you don’t control either end of that connection.

앱 스토어와 통신하기 위해 신뢰할 수있는 서버를 사용합니다. 자신의 서버를 사용하면 인식 만 서버를 신뢰하도록 응용 프로그램을 설계 할 수 있습니다, ​​당신은 서버가 앱 스토어 서버와 연결되도록 할 수 있습니다. 당신이 그 연결의 양 끝을 제어하지 않기 때문에 그것은 사용자 장치와 직접 앱 스토어간에 신뢰할 수있는 연결을 구축 할 수 없습니다.

Verifying an App Receipt
앱 영수증을 확인

Communication with the App Store is structured as JSON dictionaries, as defined in RFC 4627. To verify the receipt, perform the following steps:
RFC 4627에 정의 된 앱 스토어와의 통신은 JSON 사전으로 구성되어 있습니다.영수증을 확인하려면 다음 단계를 수행하십시오 :

  1. Retrieve the receipt data and base64 encode it (using the RFC 4648 form of base64). Use the appStoreReceiptURL method of NSBundle to locate the app’s receipt, and then read the entire file.
    수신 데이터를 base64로 (base64로의 RFC 4648 형식을 사용)로 인코딩을 검색합니다.응용 프로그램의 영수증을 찾은 다음 전체 파일을 읽을 수 NSBundle의 appStoreReceiptURL 메서드를 사용합니다.

    If the appStoreReceiptURL method is not available, you can fall back to the value of a transaction's transactionReceipt property for backward compatibility.
    appStoreReceiptURL 방법을 사용할 수없는 경우, 당신은 이전 버전과의 호환성을 위해 트랜잭션의 transactionReceipt 속성의 값으로 폴백 할 수 있습니다.

  2. Create a JSON object with a single key named receipt-data whose value is the base64-encoded receipt data. Your JSON object should look like this:
    값을 base64로 인코딩 된 수신 데이터입니다 수신 데이터라는 하나의 키와 JSON 개체를 만듭니다. 귀하의 JSON 개체는 다음과 같아야합니다 :

    {
        "receipt-data" : "(receipt bytes here)"
    }
  3. Send the JSON object to the App Store using an HTTP POST request. The URL for the store is https://buy.itunes.apple.com/verifyReceipt.
    HTTP POST 요청을 사용하여 앱 스토어에 JSON 개체를 전송합니다.저장소의 URL은 https://buy.itunes.apple.com/verifyReceipt입니다.

  4. The response received from the App Store is a JSON object with the keys status and receipt. (When validating an auto-renewable subscription, the response contains additional keys, as described in “Verifying an Auto-Renewable Subscription Receipt”). It should look something like this:
    앱 스토어에서받은 응답은 키 상태 및 영수증 JSON 개체입니다. (자동 재생 구독의 유효성을 검사 할 때, 응답은 "자동 재생 구독 수령 확인"에 설명 된 추가 키를 포함). 그것은 다음과 같이 보일 것입니다 :

    {
        "status" : 0,
        "receipt" : { (receipt here) }
    }

    If the value of the status key is 0, this is a valid receipt. If the value is anything other than 0, this receipt is invalid.
    상태 키의 값이 0 인 경우,이 유효한 영수증입니다. 값이 0 이외의 경우,이 영수증은 무효입니다.

The value of the receipt key is a JSON object that contains the receipt’s fields. For information about the fields in a receipt, see “Receipt Fields.”

영수증 키의 값은 영수증의 필드가 포함 된 JSON 개체입니다.영수증의 필드에 대한 자세한 내용은 "영수증 필드"를 참조하십시오.

Verifying an Auto-Renewable Subscription Receipt
자동 재생 구독 영수증을 확인

Verifying a receipt for an auto-renewable subscription is almost identical to the process described in “Validating Receipts With the App Store.” Your application creates a JSON object and posts it to the App Store. The JSON object for an auto-renewable subscription receipt includes a second parameter: the shared secret you created in iTunes Connect:

자동 재생 구독에 대한 영수증을 확인하기에 설명 된 프로세스와 거의 동일합니다 "앱 스토어를 통해 검증 영수증."응용 프로그램이 JSON 개체와 앱 스토어에 게시를 만듭니다. iTunes에서 생성 한 공유 비밀 연결 : 자동 재생 구독 영수증 JSON 객체는 두 번째 매개 변수를 포함

{
    "receipt-data" : "(receipt bytes here)",
    "password"     : "(shared secret bytes here)"
}

The response includes a status field that indicates whether the receipt was successfully validated.
응답 영수증의 유효성 검사가 성공적으로 완료되었는지 여부를 나타내는 상태 필드가 포함되어 있습니다.

{
    "status" : 0,
    "receipt" : { (receipt here) },
    "latest_receipt" : "(base-64 encoded receipt here)",
    "latest_receipt_info" : { (latest receipt info here) }
}

If the user’s receipt was valid and the subscription is active, the status field holds 0, and the receipt field is populated with the decoded receipt data. If your server receives a non-zero status value, use “Status codes for auto-renewable subscriptions” to interpret non-zero status codes.

사용자의 접수가 유효이고 가입이 활성 상태 인 경우, 상태 필드는 0을 보유하고 영수증 필드는 디코딩 영수증 데이터로 채워집니다. 서버가 아닌 상태 값을 수신하면 0이 아닌 상태 코드를 해석하는 "자동 갱신 구독 상태 코드"를 사용합니다.

Table 2-1  Status codes for auto-renewable subscriptions

Status Code

Description

21000

The App Store could not read the JSON object you provided.

21002

The data in the receipt-data property was malformed.

21003

The receipt could not be authenticated.

21004

The shared secret you provided does not match the shared secret on file for your account.

21005

The receipt server is not currently available.

21006

This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.

21007

This receipt is a sandbox receipt, but it was sent to the production service for verification.

21008

This receipt is a production receipt, but it was sent to the sandbox service for verification.

The receipt field on the JSON object holds the parsed information from the receipt. The receipt data for an auto-renewable subscription includes some additional keys, and some other keys are used differently for subscriptions. For information about keys found in a receipt, see “Receipt Fields.”

JSON 개체의 영수증 필드는 영수증에서 구문 분석 정보를 보유하고 있습니다.자동 재생 구독에 대한 수신 데이터는 몇 가지 추가 키를 포함하고, 다른 키는 구독 다르게 사용됩니다.영수증에있는 키에 대한 자세한 내용은 "영수증 필드"를 참조하십시오.

In addition to the receipt_data field, the response may also include two other fields. If the user’s subscription is active and was renewed by a transaction that took place after the receipt your server sent to the App Store, the latest_receipt field includes a base-64 encoded receipt for the last renewal for this subscription. The decoded data for this new receipt is also provided in the latest_expired_receipt_info field. Your server can use this new receipt to maintain a record of the most recent renewal.

receipt_data 필드 또한, 응답은 다른 두 필드를 포함 할 수 있습니다.사용자의 가입이 활성화되고 서버가 앱 스토어로 전송 수령 후 일어났다 트랜잭션에 의해 갱신 된 경우, latest_receipt 필드는이 구독에 대한 최종 갱신 base-64로 인코딩 된 영수증을 포함하고 있습니다. 이 새로운 영수증에 대한 디코드 된 데이터는 latest_expired_receipt_info 필드에 제공됩니다. 서버는 가장 최근에 갱신의 기록을 유지하기 위해이 새로운 영수증을 사용할 수 있습니다.

Posted by 창업자닉군
,