I have been struggling with implementing the Spotify iOS SDK in a simple music player app I’m working on with the intention of learning more about the streaming platform’s API. My app’s features are storyboard-based and have simple functionality (i.e. connect/disconnect, pause/play, fast forward/rewind, fetch album artwork)
I modeled my authorization method off of the demo project SPTLoginSampleAppSwift, and have been trying to troubleshoot the errors I’m getting (I’ll paste them below).
After a few weeks of struggling with this API, I decided to run the demo project on my device and realized that it does not seem to function properly either. Does anyone know how I can fix these errors and successfully initiate Spotify functionality in my app? I’m quite frustrated and would really appreciate any advice. I'm including my repo below as well.
https://github.com/dglaser2/SpotifyPlayer
ERRORS:
Upon clicking connect:
-canOpenURL: failed for URL: "spotify:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
Upon returning to app after authorization screen:
2021-01-07 16:59:16.775788-0500 SpotifyPlayerDavid[39554:3692500] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-01-07 16:59:16.907970-0500 SpotifyPlayerDavid[39554:3688560] AppRemote: Connecting...
2021-01-07 16:59:16.921229-0500 SpotifyPlayerDavid[39554:3692500] [connection] nw_socket_handle_socket_event [C2.1:1] Socket SO_ERROR [61: Connection refused]
2021-01-07 16:59:16.923633-0500 SpotifyPlayerDavid[39554:3692500] [connection] nw_socket_handle_socket_event [C2.2:1] Socket SO_ERROR [61: Connection refused]
2021-01-07 16:59:16.926122-0500 SpotifyPlayerDavid[39554:3691493] [connection] nw_connection_get_connected_socket [C2] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-01-07 16:59:16.926941-0500 SpotifyPlayerDavid[39554:3691493] TCP Conn 0x600002b6c0b0 Failed : error 0:61 [61]
2021-01-07 16:59:16.928526-0500 SpotifyPlayerDavid[39554:3688560] AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x600001228f00 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.
I encountered a weird problem trying to connect with firebase in my project. I already followed all necessary steps - firebase config, cocopod, google.plist - but I keep getting these error messages in this screenshot. Does anyone else encounter this problem and how did you resolve it?
Sceenshot
AppDelegate
import UIKit
import Firebase
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
Console
2020-10-25 10:47:24.604330-0400 test2[2991:35955] Connection 1: received failure notification
2020-10-25 10:47:24.604477-0400 test2[2991:35955] Connection 1: failed to connect 1:61, reason -1
2020-10-25 10:47:24.604584-0400 test2[2991:35955] Connection 1: encountered error(1:61)
2020-10-25 10:47:24.609628-0400 test2[2991:35955] Task <EF95DB6A-2445-4E58-9B2F-AFA35EE0A68E>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:61])
2020-10-25 10:47:24.616313-0400 test2[2991:35955] Task <EF95DB6A-2445-4E58-9B2F-AFA35EE0A68E>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSUnderlyingError=0x600001748c90 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey=https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog, NSErrorFailingURLKey=https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Could not connect to the server.}
2020-10-25 10:47:24.645716-0400 test2[2991:35949] 6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started
2020-10-25 10:47:24.649697-0400 test2[2991:35949] 6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/)
2020-10-25 10:47:24.651125-0400 test2[2991:35955] 6.34.0 - [Firebase/Analytics][I-ACS023171] Resetting App Measurement data
2020-10-25 10:47:24.752809-0400 test2[2991:35975] 6.34.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-10-25 10:47:24.788481-0400 test2[2991:35949] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-10-25 10:47:24.789629-0400 test2[2991:35949] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2020-10-25 10:47:39.183384-0400 test2[2991:36053] [] nw_socket_handle_socket_event [C3.1:3] Socket SO_ERROR [61: Connection refused]
2020-10-25 10:47:39.183765-0400 test2[2991:36053] [BoringSSL] nw_protocol_boringssl_handshake_negotiate_proceed(726) [0x7fd4bee004a0] handshake failed at state 0
2020-10-25 10:47:39.185931-0400 test2[2991:36053] Connection 3: received failure notification
2020-10-25 10:47:39.186090-0400 test2[2991:36053] Connection 3: failed to connect 1:61, reason -1
2020-10-25 10:47:39.186224-0400 test2[2991:36053] Connection 3: encountered error(1:61)
2020-10-25 10:47:39.190919-0400 test2[2991:36053] Task <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:61])
2020-10-25 10:47:39.192171-0400 test2[2991:35790] Task <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600001732970 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>"), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, NSErrorFailingURLKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, _kCFStreamErrorDomainKey=1}
2020-10-25 10:47:39.194966-0400 test2[2991:36054] 6.34.0 - [Firebase/Analytics][I-ACS901017] Encounter network error. Code, error: -1004, Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600001732970 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>"), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, NSErrorFailingURLKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, _kCFStreamErrorDomainKey=1}
2020-10-25 10:47:39.197349-0400 test2[2991:36054] 6.34.0 - [Firebase/Analytics][I-ACS023128] Network request failed to fetch remote config. Code, Error: 0, Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600001732970 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>"), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, NSErrorFailingURLKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, _kCFStreamErrorDomainKey=1}
2020-10-25 10:47:39.198538-0400 test2[2991:36054] 6.34.0 - [Firebase/Analytics][I-ACS023129] Network fetch failed. Will retry later. Code, error: 0, Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600001732970 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDownloadTask <69F833DC-E03D-46E7-A72D-DE7246C8BDFF>.<1>"), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, NSErrorFailingURLKey=https://app-measurement.com/config/app/1:955410733527:ios:c82bc7afb517ae10479392?platform=ios&app_instance_id=3A4D3A72AC624838AB769B6871063F58&gmp_version=60900, _kCFStreamErrorDomainKey=1}
1- I think everything is going well but it's appearing in the error that you may have a poor connection " Could not connect to the server "
My advice is to try it again and make sure from google Plist that it's documented under the same bundle identifier
2- If the previous doesn't work, just try to update the pod
3- In the worst case try to uninstall it & install it again
In release mode, when I run my app, if I have the app in the background for around 30 seconds and bring the app to the foreground I get the error-log:
2020-07-24 23:12:14.473633+0200 myTest[11229:3284265] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2020-07-24 23:12:14.608936+0200 myTest[11229:3284265] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
2020-07-24 23:13:06.713676+0200 myTest[11229:3284265] dnssd_clientstub read_all(15) DEFUNCT
2020-07-24 23:13:06.713798+0200 myTest[11229:3284265] [VERBOSE-2:FlutterObservatoryPublisher.mm(131)] Could not register as server for FlutterObservatoryPublisher. Check your network settings and relaunch the application.
2020-07-24 23:13:06.733470+0200 myTest[11229:3285031] [] nw_read_request_report [C1] Receive failed with error "Software caused connection abort"
2020-07-24 23:13:06.733962+0200 myTest[11229:3285031] [] nw_read_request_report [C5] Receive failed with error "Software caused connection abort"
2020-07-24 23:13:06.734091+0200 myTest[11229:3285031] [] nw_read_request_report [C4] Receive failed with error "Software caused connection abort"
2020-07-24 23:13:06.734177+0200 myTest[11229:3285031] [] nw_read_request_report [C1] Receive failed with error "Software caused connection abort"
2020-07-24 23:13:06.738494+0200 myTest[11229:3284531] dnssd_clientstub write_all(40) DEFUNCT
2020-07-24 23:13:06.738517+0200 myTest[11229:3284531] dnssd_clientstub deliver_request ERROR: write_all(40, 65 bytes) failed
2020-07-24 23:13:06.738540+0200 myTest[11229:3284531] dnssd_clientstub write_all(40) DEFUNCT
2020-07-24 23:13:06.742580+0200 myTest[11229:3285031] [] nw_read_request_report [C5] Receive failed with error "Software caused connection abort"
2020-07-24 23:13:06.751339+0200 myTest[11229:3285031] [] nw_read_request_report [C4] Receive failed with error "Software caused connection abort"
This will result in a grey-screen, freezing the app. Any idea what is causing this error or how to get around it?
I'm using firebase, maybe this is causing it?
Steps to reproduce:
Create a new app and call any API to the server to get data
immediately take the app to background
network get disconnects
below is the log:
2020-03-26 17:21:00.894598+0530 TestApp[783:152843] Connection 2: received failure notification
2020-03-26 17:21:00.895805+0530 TestApp[783:152843] Connection 2: failed to connect 1:53, reason -1
2020-03-26 17:21:00.895895+0530 TestApp[783:152843] Connection 2: encountered error(1:53)
2020-03-26 17:21:00.901375+0530 TestApp[783:152843] Task <36B9553A-99F2-42FE-8650-A5E5155EFCFD>.<1> HTTP load failed, 0/0 bytes (error code: -1005 [1:53])
2020-03-26 17:21:00.901831+0530 TestApp[783:152843] Connection 1: received failure notification
2020-03-26 17:21:00.902078+0530 TestApp[783:152843] [] nw_flow_add_write_request [C1.1 40.85.185.46:443 failed channel-flow (satisfied (Path is satisfied), interface: en0, ipv4, dns)] cannot accept write requests
2020-03-26 17:21:00.902200+0530 TestApp[783:152843] [] nw_write_request_report [C1] Send failed with error "Socket is not connected"
2020-03-26 17:21:00.905902+0530 TestApp[783:152870] Task <36B9553A-99F2-42FE-8650-A5E5155EFCFD>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x2824734e0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey=https://api.server.account, NSErrorFailingURLKey=https://api.server.account, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=53, NSLocalizedDescription=The network connection was lost.}
VPN connection created successfully on iOS 10 and also API request executes successfully.
Also, VPN connection created successfully on iOS 11.3 and 11.4 but API request get failed and showing below error:
2018-06-06 15:50:42.366512+0800 myAPP[555:197322] [] nw_path_evaluator_request_nexus_and_stats NECP_CLIENT_ACTION_REQUEST_NEXUS_INSTANCE [65: No route to host]
2018-06-06 15:50:42.366629+0800 myAPP[555:197322] [] nw_endpoint_flow_setup_channel [33 192.168.0.1:8000 in_progress channel-flow (satisfied)] failed to request nexus instance: Error Domain=kNWErrorDomainPOSIX Code=65 "No route to host" UserInfo={NSDescription=No route to host}
2018-06-06 15:50:42.366734+0800 myAPP[555:197322] TIC TCP Conn Failed [18:0x1d0374580]: 1:65 Err(65)
2018-06-06 15:50:42.366808+0800 myAPP[555:197322] Task <2FDCE10C-8CB4-469D-AAE6-E9307A68069D>.<1> HTTP load failed (error code: -1004 [1:65])
2018-06-06 15:50:42.367049+0800 myAPP[555:197506] Task <2FDCE10C-8CB4-469D-AAE6-E9307A68069D>.<1> finished with error - code: -1004
Error-Optional(Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSUnderlyingError=0x1d0650f80
{Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=65, _kCFStreamErrorDomainKey=1}}
Thanks