我花了最后一天(注意:新手Objective-C程序员,但在其他语言方面有很多经验)弄清楚为什么gtm-oauth2无法连接到Basecamp API但现在我放弃了并在这里问。
所以我有一个从头开始编写的应用程序并且它不起作用所以我攻击了gtm-oauth2提供的官方OAuth2Sample,只是用Basecamp Auth和我的正确值更改了Dailymotion示例的值得到了同样的错误。
我收到登录页面,然后是授权页面,当我点击“是的,我将允许访问”时会发生错误。
在API控制台中,我得到:
The operation couldn’t be completed. (com.google.GTMOAuth2 error -1000.)
在Xcode输出中我得到:
2012-12-05 09:35:45.569 OAuth2Sample[29512:303] *** Assertion failure in -[GTMOAuth2SignIn requestRedirectedToRequest:], /Path/To/Xcode/gtm-oauth2-read-only/Examples/OAuth2Sample/../../Source/GTMOAuth2SignIn.m:400
2012-12-05 09:35:45.570 OAuth2Sample[29512:303] *** WebKit discarded an uncaught exception in the webView:resource:willSendRequest:redirectResponse:fromDataSource: delegate: <NSInternalInconsistencyException> response lacks auth code or error
如前所述,代码与Google提供的示例相同,我只是更改了身份验证,令牌和重定向网址值。
更新:将其缩小到这个:在第394行,NSString *responseStr = [[redirectedRequest URL] query];
应该获得查询但是因为网址
2012-12-05 14:02:18.591 Basecamper[32630:303] req: http://madebybandit.com/#access_token=BAhbBy…long token here…2898
所以我尝试了fragment
而不是query
所以现在它抛出了这个:
2012-12-05 14:07:05.955 Basecamper[32630:303] -[__NSCFString unsignedLongValue]: unrecognized selector sent to instance 0x101a74f30
2012-12-05 14:07:05.956 Basecamper[32630:303] *** WebKit discarded an uncaught exception in the webView:resource:willSendRequest:redirectResponse:fromDataSource: delegate: <NSInvalidArgumentException> -[__NSCFString unsignedLongValue]: unrecognized selector sent to instance 0x101a74f30
现在是什么?