我试图获取苹果音乐API的用户令牌,我已经从python终端命令生成了有效的开发人员令牌 [英] I am try to get user token for apple music API, i have already generated valid developer token from python terminal commands

查看:294
本文介绍了我试图获取苹果音乐API的用户令牌,我已经从python终端命令生成了有效的开发人员令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的IOS应用程序中首次使用apple music api。我已经在python命令的帮助下生成了开发人员令牌。

I am using first time apple music api in my IOS app. I have already generate developer token with the help of python commands.

每次请求用户令牌时都会收到错误请求用户令牌时发生错误:操作无法完成。(SKErrorDomain错误7。)

i am getting error every time when request for the user token "An error occurred when requesting user token: The operation couldn’t be completed. (SKErrorDomain error 7.)"

我的开发人员令牌看起来像esfd ............. .................................................. .................. Mpo

my developer token look like as "esfd.................................................................................Mpo"

if #available(iOS 11.0, *)

{

 SKCloudServiceController().requestUserToken(forDeveloperToken: 
 developerToken, completionHandler: { (userToken, error) in

    print("An error occurred when requesting user token: \(error!.localizedDescription)")

})

}

else 
{    

SKCloudServiceController().requestPersonalizationToken(forClientToken: developerToken, withCompletionHandler: { (userToken, error) in

 print("An error occurred when requesting user token: \(error!.localizedDescription)")

})


}

请有人帮助我....

Please anyone help me ....

推荐答案

这是开发令牌的问题。我使用 https://github.com/pelauimagineering/apple-music-token修复了它 - 发电机。一开始,我使用另一个ruby生成器来获得开发令牌。我通过使用curl -v -H'授权:Bearer [开发人员令牌]' https://api.music.apple.com/v1/catalog/us/songs/203709340 ,但也在示例代码中得到(SKErrorDomain错误7.)。现在没关系。 ruby生成器不适用于请求用户令牌: https:// github.com/pelauimagineering/apple-music-token-generator/issues/4

It is the problem of develop token. I fixed it by using https://github.com/pelauimagineering/apple-music-token-generator. At the beginning, i use another ruby generator to get develop token. I test ok by using curl -v -H 'Authorization: Bearer [developer token]' "https://api.music.apple.com/v1/catalog/us/songs/203709340", but also get (SKErrorDomain error 7.) in sample code. Now it is ok. The ruby generator doesn’t work with requesting user tokens:https://github.com/pelauimagineering/apple-music-token-generator/issues/4

这篇关于我试图获取苹果音乐API的用户令牌,我已经从python终端命令生成了有效的开发人员令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆