模块文件是为不兼容的目标x86_64-apple-macosx10.10

时间:2017-06-08 07:09:45

标签: ios swift macos

我试图从Apple的网站Adding-Content-to-Apple-Music运行示例代码,该代码显示了如何与Apple Music Content进行交互。

然后结果是处理JWT(JSON Web Token)的问题,Objective-C和Swift中当前可用的JWT库位于jwt.io

但只有steam / jwt可以与Apple Music需要的ES256签约。我从GitHub克隆了代码," swift build"库,并将其导入项目中。但是,我在代码中的import JWT行上出现此错误:

为不兼容的目标x86_64-apple-macosx10.10

创建了模块文件

这是什么意思?我可以只在macOS中使用这个库吗?

更新:jwt模块工作在蒸汽中,我想我可以成功获得JWT。

但是当我在终端中这样做时:

enter image description here

就像苹果文件说的那样:

  

" curl -v -H'授权:持票人[开发人员代币]' " HTTPS   ://api.music.apple.com/v1/catalog/us/songs/203709340""

我收到了http状态代码500 .....

是我的错还是Apple的服务器?

请帮帮我..

1 个答案:

答案 0 :(得分:0)

我尝试在Python中使用anther库,其名称为jwcrypto。(pip install jwcrypto to get it) Python代码:

from jwcrypto import jwt,jwk
import time
currentTime = time.time()
iat = int(currentTime)
exp = iat + 10000000
p8Data = open('AuthKey_myP8file.p8')
privateKey = p8Data.read()
key = jwk.JWK(generate='EC', curve='P-256')
key.import_from_pem(data=privateKey)
Token = jwt.JWT(header={'alg':'ES256', 'kid':'myKid'},claims={'iss':'myIss','iat':iat,'exp': exp })
Token.make_signed_token(key)
t = Token.serialize()// t is the Developer Token!!

最后我得到了http状态代码200和响应!图片在这里:https://i.stack.imgur.com/67rHy.jpg