我试图为我的Android应用设置城市飞艇,但我在获取Google C2DM令牌方面遇到了麻烦。 或许,我根据Urban Airship Doc。在使用C2DM之前做了这个。
- 在命令行上运行“clientauth.py”(位于分发zip文件的“tools”目录中)
当我在Mac OS X Lion的终端上运行文件时,出现此错误。 有人可以帮我解决这个问题吗?提前谢谢!
MacBook-Pro:~ me$ python /Users/me/Documents/ua-android-lib-latest/tools/clientauth.py
C2DM Google Account: my google email for c2dm
Password for my google email for c2dm:
Traceback (most recent call last):
File "/Users/me/Documents/ua-android-lib-latest/tools/clientauth.py", line 46, in <module>
ClientLoginTokenFactory().getToken()
File "/Users/me/Documents/ua-android-lib-latest/tools/clientauth.py", line 34, in getToken
response = urllib2.urlopen(request)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
response = meth(req, response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error
return self._call_chain(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
答案 0 :(得分:1)
在您花费太多时间之前,C2DM已被弃用。您应该使用Google Cloud Messaging。 Android developer website上有迁移指南。