Field Dictionary Keys

Keys that are used at the lowest level of the pass.json file, which define an individual field.

Standard Field Dictionary Keys

Information about a field.

These keys are used for all dictionaries that define a field.

Key name

Type

Description

attributedValue

localizable string, ISO 8601 date as a string, or number

Optional. Attributed value of the field.

The value may contain HTML markup for links. Only the <a> tag and its href attribute are supported. For example, the following is key/value pair specifies a link with the text “Edit my profile”:

"attributedValue": "<a href='http://example.com/customers/123'>Edit my profile</a>"

This key’s value overrides the text specified by the value key.

Available in iOS 7.0.

changeMessage

localizable format string

Optional. Format string for the alert text that is displayed when the pass is updated. The format string must contain the escape %@, which is replaced with the field’s new value. For example, “Gate changed to %@.”

If you don’t specify a change message, the user isn’t notified when the field changes.

dataDetectorTypes

array of strings

Optional. Data dectors that are applied to the field’s value. Valid values are:

  • PKDataDetectorTypePhoneNumber

  • PKDataDetectorTypeLink

  • PKDataDetectorTypeAddress

  • PKDataDetectorTypeCalendarEvent

The default value is all data detectors. Provide an empty array to use no data detectors.

Data detectors are applied only to back fields.

key

string

Required. The key must be unique within the scope of the entire pass. For example, “departure-gate”.

label

localizable string

Optional. Label text for the field.

textAlignment

string

Optional. Alignment for the field’s contents. Must be one of the following values:

  • PKTextAlignmentLeft

  • PKTextAlignmentCenter

  • PKTextAlignmentRight

  • PKTextAlignmentNatural

The default value is natural alignment, which aligns the text appropriately based on its script direction.

This key is not allowed for primary fields or back fields.

value

localizable string, ISO 8601 date as a string, or number

Required. Value of the field. For example, 42.

Date Style Keys

Information about how a date should be displayed in a field.

If any of these keys is present, the value of the field is treated as a date. Either specify both a date style and a time style, or neither.

Key name

Type

Description

dateStyle

string

Style of date to display. Must be one of the styles listed in Table 4-1.

ignoresTimeZone

Boolean

Optional. Always display the time and date in the given time zone, not in the user’s current time zone. The default value is false.

The format for a date and time always requires a time zone, even if it will be ignored. For backward compatibility with iOS 6, provide an appropriate time zone, so that the information is displayed meaningfully even without ignoring time zones.

This key does not affect how relevance is calculated.

Available in iOS 7.0.

isRelative

Boolean

Optional. If true, the label’s value is displayed as a relative date; otherwise, it is displayed as an absolute date. The default value is false.

This does not affect how relevance is calculated.

timeStyle

string

Style of time to display. Must be one of the styles listed in Table 4-1.

The date styles and time styles have the same meaning as the Cocoa formatter styles with corresponding names, as shown in Table 4-1.

Table 4-1  Date and time styles

Date style

Corresponding formatter style

PKDateStyleNone

NSDateFormatterNoStyle

PKDateStyleShort

NSDateFormatterShortStyle

PKDateStyleMedium

NSDateFormatterMediumStyle

PKDateStyleLong

NSDateFormatterLongStyle

PKDateStyleFull

NSDateFormatterFullStyle

Number Style Keys

Information about how a number should be displayed in a field.

These keys are optional if the field’s value is a number; otherwise they are not allowed. Only one of these keys is allowed per field.

Key name

Type

Description

currencyCode

string

ISO 4217 currency code for the field’s value.

numberStyle

string

Style of number to display. Must be one of the following values:

  • PKNumberStyleDecimal

  • PKNumberStylePercent

  • PKNumberStyleScientific

  • PKNumberStyleSpellOut

Number styles have the same meaning as the Cocoa number formatter styles with corresponding names. For more information, see NSNumberFormatterStyle.