2015-10-20 23 views
0

是否有可能通過iOS Spotify SDK告訴與當前用戶帳戶相關聯的國家/地區?怎麼樣?我在the docs中找不到任何東西。使用Spotify iOS SDK,我該如何判斷用戶連接到哪個市場?

(我想獲得ISO 3166-1 alpha-2國家/地區代碼,以便另一個(未經身份驗證的)用戶可以使用web api執行搜索,並只查找最終能夠使用經過身份驗證的曲目正在使用SDK的用戶)。

回答

0

找到它。它可從SPTUser對象的territory字段中獲得。下面是你可能已經登錄後得到它,接受了斯威夫特一個session對象,示例代碼:設立時

SPTUser.requestCurrentUserWithAccessToken(session.accessToken) { error, object in   
    guard let user = object as? SPTUser, 
       territory = user.territory else { 
     print("Could not get territory, error: \(error)" 
     return 
    } 
    print(territory) 
} 

但是,除非你已包括在requestedScopesSPTAuthUserReadPrivateScope你會得到零值境內您SPTAuth對象。

相關問題