Skip to content

Search

Documentation

apple module

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

På den här sidan

Apple services beyond platform.*: Game Center identity, purchases, notifications. Calls answer on a later tick as a map whose kind is an EVENT_* constant, to the node's on_apple_event or the awaited id.

20 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(any, any?) -> any — Show or hide Game Center's floating access point, and answer whether it is showing; location is a corner: top_leading, top_trailing, bottom_leading or bottom_trailing.
authenticated() -> any — Whether Game Center has a signed-in player right now.
available() -> any — Whether this build has Apple's frameworks behind it.
cancel_notification(any) -> any — Drop a scheduled notification, and take a delivered one out of the shade.
credential_state(any, any?, any?) -> any — Ask whether a saved Sign in with Apple account is still authorized, revoked, transferred or unknown.
entitlements(any?, any?) -> any — What this player currently owns, each with the signed transaction a server checks.
finish_purchase(any, any?, any?) -> any — Tell StoreKit a transaction is dealt with. One that is never finished comes back on every launch.
identity(any?, any?) -> any — Fetch the items a server needs to verify this Game Center player, and return the id the answer carries.
listen(any, any?) -> any — Subscribe a node's method to everything that arrives unasked: 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.
listen_for_cloud_changes() -> any — Hear about another device changing the iCloud key-value store, as cloud_changed with the reason and the keys it touched.
listen_for_invites() -> any — 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() -> any — 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(any, any?, any?) -> any — Schedule a local notification. The options take title, after in seconds and an id to cancel or recognise it by.
products(any, any?, any?) -> any — Ask the App Store about a list of product ids, and answer with what it knows: title, description, price and display price.
purchase(any, any?, any?) -> any — Buy a product. The answer is purchased, cancelled or pending, and a purchase carries the signed jws a server checks.
register_for_push() -> any — Ask the OS for a push token. It arrives at everything listening, not at the caller, because the OS hands it over whenever it likes.
request_notifications(any?, any?) -> any — Ask the player to allow notifications, and answer with what they said.
restore_purchases(any?, any?) -> any — Ask the App Store to hand this device's purchases back: the button a review expects a game to have.
show_dashboard(any?, any?) -> any — Open Game Center's dashboard over the game; state picks the page : default, leaderboards, achievements, challenges, profile, dashboard or friends.
sign_in(any?, any?) -> any — 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