diff --git a/CHANGELOG.md b/CHANGELOG.md index dc494c1..a36991f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Spotify iOS SDK v2.1.3 +What's New: +- Fix bug in the web authentication when using Universal Links in the redirect URI + ## Spotify iOS SDK v2.1.2 What's New: - Dismiss authentication screen when Spotify app is installed. diff --git a/DemoProjects/SPTLoginSampleApp/SPTLoginSampleApp/AppDelegate.m b/DemoProjects/SPTLoginSampleApp/SPTLoginSampleApp/AppDelegate.m index bd2c399..350fa11 100644 --- a/DemoProjects/SPTLoginSampleApp/SPTLoginSampleApp/AppDelegate.m +++ b/DemoProjects/SPTLoginSampleApp/SPTLoginSampleApp/AppDelegate.m @@ -24,9 +24,15 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary *)options { - [self.rootViewController.sessionManager application:application openURL:URL options:options]; - NSLog(@"%@ %@", URL, options); - return YES; + // Use this method if your SpotifyRedirectURL is a native deeplink + return [self.rootViewController.sessionManager application:application openURL:URL options:options]; +} + +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray> * _Nullable))restorationHandler { + // Use this method if your SpotifyRedirectURL is an universal link (https/http) + return [self.rootViewController.sessionManager application:application + continueUserActivity:userActivity + restorationHandler:restorationHandler]; } @end diff --git a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift.xcodeproj/project.pbxproj b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift.xcodeproj/project.pbxproj index 1990f32..c7e6530 100644 --- a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift.xcodeproj/project.pbxproj +++ b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift.xcodeproj/project.pbxproj @@ -32,7 +32,6 @@ /* Begin PBXFileReference section */ 12EE828B2BCD4536003F62A0 /* SpotifyiOS.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SpotifyiOS.xcframework; path = ../../SpotifyiOS.xcframework; sourceTree = ""; }; - 5413459E20D1049200FD05F7 /* SPTLoginSampleAppSwift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPTLoginSampleAppSwift-Bridging-Header.h"; sourceTree = ""; }; 54AC7EDC20081243008CD692 /* SPTLoginSampleAppSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SPTLoginSampleAppSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54AC7EDF20081243008CD692 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 54AC7EE120081243008CD692 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -88,7 +87,6 @@ 54AC7EE620081243008CD692 /* Assets.xcassets */, 54AC7EE820081243008CD692 /* LaunchScreen.storyboard */, 54AC7EEB20081243008CD692 /* Info.plist */, - 5413459E20D1049200FD05F7 /* SPTLoginSampleAppSwift-Bridging-Header.h */, ); path = SPTLoginSampleAppSwift; sourceTree = ""; @@ -247,7 +245,6 @@ OTHER_LDFLAGS = "-ObjC"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OBJC_BRIDGING_HEADER = "SPTLoginSampleAppSwift/SPTLoginSampleAppSwift-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -305,7 +302,6 @@ OTHER_LDFLAGS = "-ObjC"; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OBJC_BRIDGING_HEADER = "SPTLoginSampleAppSwift/SPTLoginSampleAppSwift-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; diff --git a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/AppDelegate.swift b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/AppDelegate.swift index 3b81b49..ebdb2ff 100644 --- a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/AppDelegate.swift +++ b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/AppDelegate.swift @@ -14,10 +14,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { - rootViewController.sessionManager.application(app, open: url, options: options) - return true + // Use this method if your SpotifyRedirectURL is a native deeplink + return rootViewController.sessionManager.application(app, open: url, options: options) } + func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { + // Use this method if your SpotifyRedirectURL is an universal link (https/http) + return rootViewController.sessionManager.application(application, continue: userActivity, restorationHandler: restorationHandler) + } + func applicationWillResignActive(_ application: UIApplication) { if (rootViewController.appRemote.isConnected) { rootViewController.appRemote.disconnect() diff --git a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift-Bridging-Header.h b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift-Bridging-Header.h deleted file mode 100644 index f593df5..0000000 --- a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift-Bridging-Header.h +++ /dev/null @@ -1,5 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// - -#import diff --git a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/ViewController.swift b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/ViewController.swift index 65956a6..27f4f2e 100644 --- a/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/ViewController.swift +++ b/DemoProjects/SPTLoginSampleAppSwift/SPTLoginSampleAppSwift/ViewController.swift @@ -1,4 +1,5 @@ import UIKit +import SpotifyiOS class ViewController: UIViewController, SPTSessionManagerDelegate, SPTAppRemoteDelegate, SPTAppRemotePlayerStateDelegate { diff --git a/SpotifyiOS.framework/Versions/A/Headers/SPTSessionManager.h b/SpotifyiOS.framework/Versions/A/Headers/SPTSessionManager.h index 7f48942..27bd1d9 100644 --- a/SpotifyiOS.framework/Versions/A/Headers/SPTSessionManager.h +++ b/SpotifyiOS.framework/Versions/A/Headers/SPTSessionManager.h @@ -78,9 +78,17 @@ typedef NSString * const SPTAuthorizationCode; @param options The options passed in to the matching `AppDelegate` method @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. */ -- (BOOL)application:(UIApplication *)application - openURL:(NSURL *)URL - options:(NSDictionary *)options; +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary *)options; + +/** + Handle continueUserActivity callbacks from the `AppDelegate` + + @param application The `UIApplication` passed into the matching `AppDelegate` method + @param userActivity An object encapsulating a user activity supported by this responder. + @param restorationHandler A block to execute if your app creates objects to perform the task the user was performing + @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. +*/ +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray> * __nullable restorableObjects))restorationHandler; @end diff --git a/SpotifyiOS.framework/Versions/A/SpotifyiOS b/SpotifyiOS.framework/Versions/A/SpotifyiOS index 2958876..eb4eb88 100644 Binary files a/SpotifyiOS.framework/Versions/A/SpotifyiOS and b/SpotifyiOS.framework/Versions/A/SpotifyiOS differ diff --git a/SpotifyiOS.xcframework/Info.plist b/SpotifyiOS.xcframework/Info.plist index 14a9c8d..bd62a64 100644 --- a/SpotifyiOS.xcframework/Info.plist +++ b/SpotifyiOS.xcframework/Info.plist @@ -8,32 +8,32 @@ BinaryPath SpotifyiOS.framework/SpotifyiOS LibraryIdentifier - ios-arm64_x86_64-simulator + ios-arm64 LibraryPath SpotifyiOS.framework SupportedArchitectures arm64 - x86_64 SupportedPlatform ios - SupportedPlatformVariant - simulator BinaryPath SpotifyiOS.framework/SpotifyiOS LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath SpotifyiOS.framework SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator CFBundlePackageType diff --git a/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h b/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h index 7f48942..27bd1d9 100644 --- a/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +++ b/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h @@ -78,9 +78,17 @@ typedef NSString * const SPTAuthorizationCode; @param options The options passed in to the matching `AppDelegate` method @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. */ -- (BOOL)application:(UIApplication *)application - openURL:(NSURL *)URL - options:(NSDictionary *)options; +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary *)options; + +/** + Handle continueUserActivity callbacks from the `AppDelegate` + + @param application The `UIApplication` passed into the matching `AppDelegate` method + @param userActivity An object encapsulating a user activity supported by this responder. + @param restorationHandler A block to execute if your app creates objects to perform the task the user was performing + @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. +*/ +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray> * __nullable restorableObjects))restorationHandler; @end diff --git a/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS b/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS index f1a0454..5072822 100755 Binary files a/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS and b/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS differ diff --git a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h index 7f48942..27bd1d9 100644 --- a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +++ b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h @@ -78,9 +78,17 @@ typedef NSString * const SPTAuthorizationCode; @param options The options passed in to the matching `AppDelegate` method @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. */ -- (BOOL)application:(UIApplication *)application - openURL:(NSURL *)URL - options:(NSDictionary *)options; +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary *)options; + +/** + Handle continueUserActivity callbacks from the `AppDelegate` + + @param application The `UIApplication` passed into the matching `AppDelegate` method + @param userActivity An object encapsulating a user activity supported by this responder. + @param restorationHandler A block to execute if your app creates objects to perform the task the user was performing + @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`. +*/ +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray> * __nullable restorableObjects))restorationHandler; @end diff --git a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS index b882088..f94cc70 100755 Binary files a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS and b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS differ diff --git a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources index 5d54566..d90cfd4 100644 --- a/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +++ b/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources @@ -114,7 +114,7 @@ Headers/SPTSessionManager.h - SBxEZidPSxu0kqTbIjqSsm5a77Y= + rai/PC+ZQFztLKBArW5cdy62CmY= Headers/SpotifyAppRemote.h @@ -332,7 +332,7 @@ hash2 - Wldpc0wHvSO51aH3GNEzkjoNiJ6dahRIY18k3tOBxbY= + +NUHlxSqOqjmXLYO7IpjGmFXc8zaq9pI7L/82/PJCcc= Headers/SpotifyAppRemote.h diff --git a/docs/auth.md b/docs/auth.md index 18b178e..b9a2f5c 100644 --- a/docs/auth.md +++ b/docs/auth.md @@ -37,10 +37,19 @@ The main entry point for authentication if you need to authorize without startin ```objective-c - (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary *)options { - [self.sessionManager application:application openURL:URL options:options]; + return [self.sessionManager application:application openURL:URL options:options]; } ``` + If you using a Universal Link in the redirect URI, you should use this delegate method instead: + + ```objective-c + - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray> * _Nullable))restorationHandler { + return [self.rootViewController.sessionManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler] + } + ``` + + 5. If using `SPTAppRemote` to control playback be sure to set the returned token on its connection parameters in the `SPTSessionManager` delegate callback. ```objective-c diff --git a/docs/html/Blocks/SPTAppRemoteCallback.html b/docs/html/Blocks/SPTAppRemoteCallback.html index 33f63d3..360641c 100644 --- a/docs/html/Blocks/SPTAppRemoteCallback.html +++ b/docs/html/Blocks/SPTAppRemoteCallback.html @@ -112,7 +112,7 @@

Declared In