我正在嘗試SPDY for iOS應用程序,它目前使用AFNetworking(2.1.0)來處理HTTP請求。服務器端,我使用的是Google App Engine(與SPDYCheck一起檢測),它對SPDY友好。SPDY for iOS with AFNetworking
下面是我如何在我的代碼中集成SPDY。
我使用AFHTTPRequestOperationManager
@interface MyClient : AFHTTPRequestOperationManager
我嵌入式SPDY在initWithBaseURL:
- (id)initWithBaseURL:(NSURL *)url {
self = [super initWithBaseURL:url];
if (!self) {
return nil;
}
// SPDY Config
NSString *spdyURL = [NSString stringWithFormat:@"%@://%@:443",url.scheme, url.host];
[SPDYURLConnectionProtocol registerOrigin:spdyURL];
...
}
注意我的網址與格式https://myapp.appspot.com/_ah/
所以我傳遞給SPDY registerOrigin:
時spdyURL看起來像重新格式化https://myapp.appspot.com:443
我想這就是我需要的一切?但添加SPDY代碼後,我無法發送請求。調試消息顯示以下錯誤:
error response from api/users/v1/is_token_valid :
Error Domain=NSURLErrorDomain
Code=-1001
"The request timed out."
UserInfo=0xdc2c250 {NSErrorFailingURLStringKey=https://myapp.appspot.com/_ah/api/users/v1/is_token_valid?
user_token=[a_token],
NSErrorFailingURLKey=https://myapp.appspot.com/_ah/api/users/v1/is_token_valid?
user_token=[a_token],
NSLocalizedDescription=The request timed out., NSUnderlyingError=0xf270e60 "The request timed out."}
我根本沒有線索。希望在iOS上有SPDY經驗的人可以幫忙!
是的,我在github上發佈了一個問題,並得到了相同的回覆.. – xialin
@David Caunt你好先生我可以整合CocoaSPDY的Mozilla FireFox ios應用程序? – ShreePool