SPTAppRemote Class Reference
Inherits from | NSObject |
---|---|
Declared in | SPTAppRemote.h |
Overview
The SPTAppRemote
is the main entry point for interacting with the Spotify app using the Spotify App Remote for
iOS.
– initWithConfiguration:logLevel:
Convenience Initializer for a new App Remote instance
- (instancetype)initWithConfiguration:(SPTConfiguration *)configuration logLevel:(SPTAppRemoteLogLevel)logLevel
Parameters
configuration |
The |
---|---|
logLevel |
The lowest severity to log to console. |
Declared In
SPTAppRemote.h
– initWithConfiguration:connectionParameters:logLevel:
Designated Initializer for a new App Remote instance
- (instancetype)initWithConfiguration:(SPTConfiguration *)configuration connectionParameters:(SPTAppRemoteConnectionParams *)connectionParameters logLevel:(SPTAppRemoteLogLevel)logLevel
Parameters
configuration |
The |
---|---|
connectionParameters |
|
logLevel |
The lowest severity to log to console. |
Declared In
SPTAppRemote.h
+ appRemoteVersion
Determine the current version of the Spotify App Remote
+ (NSString *)appRemoteVersion
Return Value
The current version of the Spotify App Remote
Declared In
SPTAppRemote.h
+ spotifyItunesItemIdentifier
The Spotify app iTunes item identifier for use with SKStoreProductViewController
for installing Spotify from the
App Store.
+ (NSNumber *)spotifyItunesItemIdentifier
Return Value
An NSNumber
representing the Spotify iTunes item identifier to be used for the
SKStoreProductParameterITunesItemIdentifier
key
Declared In
SPTAppRemote.h
connectionParameters
The parameters to use during connection.
@property (nonatomic, strong, readonly) SPTAppRemoteConnectionParams *connectionParameters
Declared In
SPTAppRemote.h
connected
YES
if the App Remote is connected to the Spotify application, otherwise NO
.
@property (nonatomic, assign, readonly, getter=isConnected) BOOL connected
Discussion
Note: Not KVO’able.
See The SPTAppRemoteDelegate
in order to receive updates when the connection status changes.
Declared In
SPTAppRemote.h
delegate
The delegate to notify for connection status changes and other events originating from the App Remote.
@property (nonatomic, weak) id<SPTAppRemoteDelegate> delegate
Declared In
SPTAppRemote.h
– connect
Attempts to connect to the Spotify application.
- (void)connect
Discussion
If the Spotify app is not running you will need to use authorizeAndPlayURI: to wake it up
Declared In
SPTAppRemote.h
– connectWithSessionIdentifier:
Attempts to connect to the Spotify application with a given session identifier.
- (void)connectWithSessionIdentifier:(NSUUID *)sessionIdentifier
Parameters
sessionIdentifier |
The unique session identifier which was used when calling
|
---|
Discussion
If the Spotify app is not running you will need to use authorizeAndPlayURI: to wake it up.
If authorizeAndPlayURI
was used without a given session identifier, connect
should be used instead of
this method.
Declared In
SPTAppRemote.h
– authorizeAndPlayURI:completionHandler:
Open Spotify app to obtain access token and start playback. The passed URI will start playing unless Spotify is already playing.
- (void)authorizeAndPlayURI:(NSString *)URI completionHandler:(void ( ^ __nullable ) ( BOOL success ))completionHandler
Parameters
URI |
The URI to play. Use a blank string to attempt to play the user’s last song |
---|---|
completionHandler |
Note: The return |
Declared In
SPTAppRemote.h
– authorizeAndPlayURI:asRadio:completionHandler:
Open Spotify app to obtain access token and start playback.
- (void)authorizeAndPlayURI:(NSString *)playURI asRadio:(BOOL)asRadio completionHandler:(void ( ^ __nullable ) ( BOOL success ))completionHandler
Parameters
playURI |
The URI to play. Use a blank string to attempt to play the user’s last song |
---|---|
asRadio |
|
completionHandler |
Note: The return |
Declared In
SPTAppRemote.h
– authorizeAndPlayURI:asRadio:additionalScopes:completionHandler:
Open Spotify app to obtain access token and start playback.
- (void)authorizeAndPlayURI:(NSString *)playURI asRadio:(BOOL)asRadio additionalScopes:(nullable NSArray<NSString*> *)additionalScopes completionHandler:(void ( ^ __nullable ) ( BOOL success ))completionHandler
Parameters
playURI |
The URI to play. Use a blank string to attempt to play the user’s last song |
---|---|
asRadio |
|
additionalScopes |
An array of scopes in addition to |
completionHandler |
Note: The return |
Declared In
SPTAppRemote.h
– authorizeAndPlayURI:asRadio:additionalScopes:sessionIdentifier:completionHandler:
Open Spotify app to obtain access token and start playback.
- (void)authorizeAndPlayURI:(NSString *)playURI asRadio:(BOOL)asRadio additionalScopes:(nullable NSArray<NSString*> *)additionalScopes sessionIdentifier:(nullable NSUUID *)sessionIdentifier completionHandler:(void ( ^ __nullable ) ( BOOL success ))completionHandler
Parameters
playURI |
The URI to play. Use a blank string to attempt to play the user’s last song |
---|---|
asRadio |
|
additionalScopes |
An array of scopes in addition to |
sessionIdentifier |
An optional unique identifier for this specific session, which is used for analytics
purposes. Every new attempt to connect to the Spotify app should have a new identifier, but the identifier used here
should then be reused for the accompanied call to |
completionHandler |
Note: The return |
Declared In
SPTAppRemote.h
– authorizationParametersFromURL:
Parse out an access token or error description from a url passed to application:openURL:options:
- (nullable NSDictionary<NSString*,NSString*> *)authorizationParametersFromURL:(NSURL *)url
Parameters
url |
The URL returned from the Spotify app after calling authorizeAndPlayURI |
---|
Return Value
A dictionary containing the access token or error description from the provided URL.
Will return nil if the URL Scheme does not match the redirect URI provided.
Use SPTAppRemoteAccessTokenKey
and SPTAppRemoteErrorDescriptionKey
to get the appropriate values.
Declared In
SPTAppRemote.h
playerAPI
The API used to control the Spotify player.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemotePlayerAPI> playerAPI
Discussion
Note: Will only be populated when the App Remote is connected. If you retain this object you must release it on disconnect.
Declared In
SPTAppRemote.h
imageAPI
The API used to fetch images from the Spotify app.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemoteImageAPI> imageAPI
Discussion
Note: Will only be populated when the App Remote is connected. If you retain this object you must release it on disconnect.
Declared In
SPTAppRemote.h
userAPI
The API used to fetch user data from the Spotify app.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemoteUserAPI> userAPI
Discussion
Note: Will only be populated when the App Remote is connected. If you retain this object you must release it on disconnect.
Declared In
SPTAppRemote.h
contentAPI
The API used to fetch content from the Spotify app.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemoteContentAPI> contentAPI
Discussion
Note: Will only be populated when the App Remote is connected. If you retain this object you must release it on disconnect.
Declared In
SPTAppRemote.h
connectivityAPI
The API used to get connectivity data from the Spotify app.
@property (nullable, nonatomic, strong, readonly) id<SPTAppRemoteConnectivityAPI> connectivityAPI
Discussion
Note: Will only be populated when the App Remote is connected. If you retain this object you must release it on disconnect.
Declared In
SPTAppRemote.h