CalStoreCountry Class Reference

Declared in CalStoreCountry.h

Overview

The CalendarStore frameworks supports multiple different countries (locations). A CalStoreCountry object holds information about a country that is supported in the Calendar Store.

The iso3166Code property is the code that should be used for the location property of the CalStoreController to change the CalendarStore to a country.

When displaying CalStoreCountry objects to the user, always show the localizedName, which is localized according to the locale property from CalStoreController.

Available Translations

The Calendar Store associated with a country can support multiple translations. For example, The German Calendar Store data can be shown in German or English, while the Canadian Calendar Store can be shown in French, Dutch and English.

To get the list of possible translations for a country, use the availableTranslations property of a CalStoreCountry object. When this property is nil, the data needs to be fetched using the fetchAvailableTranslationsWithCompletionHandler: method. This method will fetch the data asynchronously from and will call the completionHandler when it is available.

Information

  countryId

The id for this country.

@property (nonatomic, readonly) NSString *countryId

Declared In

CalStoreCountry.h

  iso3166Code

The ISO3166 code for this country. Assign this to the location property of the CalStoreController sharedController instance to change the country of the Calendar Store.

@property (nonatomic, readonly) NSString *iso3166Code

Discussion

This is an ISO3166 code, see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 .

Declared In

CalStoreCountry.h

Getting name

  name

The non-localized name for this country. Should not be user-facing.

@property (nonatomic, readonly) NSString *name

Declared In

CalStoreCountry.h

  localizedName

The localized name for this country. Use this property when you need to display a country to the user.

@property (nonatomic, readonly) NSString *localizedName

Declared In

CalStoreCountry.h

Getting an icon

  icon

The (flag-)icon for this country.

@property (nonatomic, readonly) CalStoreIcon *icon

Declared In

CalStoreCountry.h

Available Translations

  availableTranslations

A list of CalStoreAvailableTranslation objects, which define the supported locales for this country. If nil, use fetchAvailableTranslationsWithCompletionHandler: to fetch the list asynchronously from the API.

@property (nonatomic, readonly) NSArray *availableTranslations

Discussion

A CalendarStore can support different translations in which the content can be given back. This array holds a list of CalStoreAvailableTranslation objects, which tell which locales are supported for the given country.

To change the locale for the CalendarStore, use the locale property of the CalStoreController sharedInstance object.

Declared In

CalStoreCountry.h

Fetching Available Translations

  fetchingAvailableTranslations

YES if this object is busy fetching availableTranslations, NO otherwise. Only one fetchAvailableTranslationsWithCompletionHandler: operation can be performed per CalStoreCountry object at the same time.

@property (nonatomic, readonly, getter=isFetchingAvailableTranslations) BOOL fetchingAvailableTranslations

Declared In

CalStoreCountry.h

– fetchAvailableTranslationsWithCompletionHandler:

Call when availableTranslations is nil. Will asynchronously fetch the availableTranslations from the API.

- (void)fetchAvailableTranslationsWithCompletionHandler:(CalStoreCountryAvailableTranslationsCompletionHandler)completionHandler

Parameters

completionHandler

When the fetch operation finishes, the completionHandler will be invoked on the main queue.

Discussion

Note: Calling this method when fetchingAvailableTranslations is YES will raise an exception.

This method will use the authorizationToken from the CalStoreController. If you want to provide the authorizationToken yourself, use fetchAvailableTranslationsWithCompletionHandler:

Declared In

CalStoreCountry.h

– fetchAvailableTranslationsWithCompletionHandler:authorizationToken:

Same as fetchAvailableTranslationsWithCompletionHandler:, but with the option of using a custom authorizationToken.

- (void)fetchAvailableTranslationsWithCompletionHandler:(CalStoreCountryAvailableTranslationsCompletionHandler)completionHandler authorizationToken:(NSString *)authorizationToken

Parameters

completionHandler

When the fetch operation finishes, the completionHandler will be invoked on the main queue.

authorizationToken

the AuthorizationToken to use for the underlying API request that’s being made

Discussion

Note: Only use if you need to provide a different token than the one used by CalStoreController.

Declared In

CalStoreCountry.h

– cancelAvailableTranslationsFetch

Cancels an ongoing fetch request for availableTranslations.

- (void)cancelAvailableTranslationsFetch

Declared In

CalStoreCountry.h