Skip to content

Search

Documentation

apple

Apple services beyond platform.: Game Center identity, purchases, notifications. Calls answer task::wait on a later tick as a map whose kind is an EVENT_…

On this page

Apple services beyond platform.*: Game Center identity, purchases, notifications. Calls answer task::wait on a later tick as a map whose kind is an EVENT_* constant. What arrives unasked is the apple_event event, events::listen(node, "apple_event"): a notification tapped or shown in front, a push and its payload, a URL opened, an invite, an iCloud change, a transaction that landed elsewhere.

19 functions, 25 constants. Scripts reach it as apple::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

function acts on what it does
access_point(bool, apple::AccessPointOptions?) -> bool — Show or hide Game Center's floating access point, and answer whether it is showing.
authenticated() -> bool — Whether Game Center has a signed-in player right now.
available() -> bool — Whether this build has Apple's frameworks behind it.
cancel_notification(string) — Drop a scheduled notification, and take a delivered one out of the shade.
credential_state(string) -> int — Ask whether a saved Sign in with Apple account is still authorized, revoked, transferred or unknown, and return the id the answer carries.
entitlements() -> int — What this player currently owns: returns the id whose entitlements answer holds them as items, each a Transaction.
finish_purchase(string) -> int — Tell StoreKit a transaction is dealt with, and return the id its finished answer carries. One that is never finished comes back on every launch.
identity() -> int — Fetch the items a server needs to verify this Game Center player, and return the id the answer carries.
listen_for_cloud_changes() -> bool — Hear about another device changing the iCloud key-value store, as cloud_changed with the reason and the keys it touched.
listen_for_invites() -> bool — Hear about Game Center invites the player accepts, as invite_accepted with the sender's player id and name, and matches they ask for, as match_requested with the players.
listen_for_urls() -> bool — Hear about URLs the game is asked to open while it runs. A URL the game was launched with arrives before the engine boots and is not one of them.
notify(string, apple::NotifyOptions?) -> int — Schedule a local notification, and return the id its scheduled answer carries.
products([str]) -> int — Ask the App Store about a list of product ids, and return the id whose products answer holds what it knows, each a Product.
purchase(string) -> int — Buy a product, and return the id its answer carries: purchased, cancelled or pending, and a purchase carries the signed jws a server checks.
register_for_push() -> bool — Ask the OS for a push token. It arrives as the apple_event event, not at the caller, because the OS hands it over whenever it likes.
request_notifications() -> int — Ask the player to allow notifications, and return the id whose notifications answer says what they said.
restore_purchases() -> int — Ask the App Store to hand this device's purchases back, the button a review expects a game to have, and return the id its restored answer carries.
show_dashboard(apple::ShowDashboardOptions?) -> int — Open Game Center's dashboard over the game, and return the id its dashboard_closed answer carries.
sign_in() -> int — Sign in with Apple, and return the id the identity token comes back on. Game Center's own sign-in is platform.sign_in.

Constants

name value
EVENT_CANCELLED "cancelled"
EVENT_CLOUD_CHANGED "cloud_changed"
EVENT_CREDENTIAL_STATE "credential_state"
EVENT_DASHBOARD_CLOSED "dashboard_closed"
EVENT_ENTITLEMENTS "entitlements"
EVENT_ERROR "error"
EVENT_FINISHED "finished"
EVENT_IDENTITY "identity"
EVENT_INVITE_ACCEPTED "invite_accepted"
EVENT_MATCH_REQUESTED "match_requested"
EVENT_NOTIFICATIONS "notifications"
EVENT_NOTIFICATION_OPENED "notification_opened"
EVENT_NOTIFICATION_RECEIVED "notification_received"
EVENT_PENDING "pending"
EVENT_PRODUCTS "products"
EVENT_PURCHASED "purchased"
EVENT_PUSH_FAILED "push_failed"
EVENT_PUSH_RECEIVED "push_received"
EVENT_PUSH_TOKEN "push_token"
EVENT_RESTORED "restored"
EVENT_SCHEDULED "scheduled"
EVENT_SIGNED_IN "signed_in"
EVENT_TRANSACTION "transaction"
EVENT_UNSUPPORTED "unsupported"
EVENT_URL "url"

Are you sure?