Failed Uploads Fix
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- objective-c
- 领域
- mobile-dev
调研方向
从 TripManager.m 中的 connection:didReceiveResponse: 开始,检查 NSHTTPURLResponse 的状态码如何映射到上传结果。将已处理的状态与应用使用的服务器响应进行比较,然后验证成功的上传不再显示 kServerError 消息。
由索引模型根据 Issue 内容生成。
描述
Lloyd and I think we figured out the reason why uploads are failing. In TripManager.m there is a switch statement which runs through a bunch of server responses and if it does not receive any of them defaults to a kServerError message which prints "Upload Failed. Try again later." We just need to rewrite the switch statement to cover all scenarios of server responses because uploads are going through but the server is not passing a message back that the switch statement can interpret so it is defaulting to a failed upload.
\- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
// this method is called when the server has determined that it
// has enough information to create the NSURLResponse
NSLog(@"didReceiveResponse: %@", response);
```
NSHTTPURLResponse *httpResponse = nil;
if ( [response isKindOfClass:[NSHTTPURLResponse class]] &&
( httpResponse = (NSHTTPURLResponse*)response ) )
{
BOOL success = NO;
NSString *title = nil;
NSString *message = nil;
switch ( [httpResponse statusCode] )
{
case 200:
case 201:
success = YES;
title = kSuccessTitle;
message = kSaveSuccess;
break;
case 202:
success = YES;
title = kSuccessTitle;
message = kSaveAccepted;
break;
case 500:
default:
title = @"Internal Server Error";
//message = [NSString stringWithFormat:@"%d", [httpResponse statusCode]];
message = kServerError;
}
NSLog(@"%@: %@", title, message);
//
// DEBUG
NSLog(@"+++++++DEBUG didReceiveResponse %@: %@", [response URL],[(NSHTTPURLResponse*)response allHeaderFields]);
if ( success )
{
[note setUploaded:[NSDate date]];
NSError *error;
if (![managedObjectContext save:&error]) {
// Handle the error.
NSLog(@"TripManager setUploaded error %@, %@", error, [error localizedDescription]);
}
[uploadingView loadingComplete:kSuccessTitle delayInterval:.7];
} else {
[uploadingView loadingComplete:kServerError delayInterval:1.5];
}
}
// it can be called multiple times, for example in the case of a
// redirect, so each time we reset the data.
// receivedData is declared as a method instance elsewhere
[receivedDataNoted setLength:0];
```
}
- 主要语言
- Objective-C
- 星标
- 16
- 派生
- 25
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeForPhilly/CyclePhilly-iOS-app 的其他 Issue
-
enhancement
难度 4/5 3-5 天 新手友好度 25/100
-
You Can Use POD 未关闭
难度 4/5 3-5 天 新手友好度 25/100
-
Love the App! 未关闭
难度 5/5 一周以上 新手友好度 20/100
-
Upload time 未关闭
难度 2/5 1-3 小时 新手友好度 45/100
查看 CodeForPhilly/CyclePhilly-iOS-app 的全部 Issue
相似的 Issue
-
Icons Metro Public Transport
难度 1/5 1 小时以内 新手友好度 75/100
organicmaps/organicmaps#13617 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
objective-see/LuLu#925 ·
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 72/100
noah-nuebling/mac-mouse-fix#2054 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
obsproject/obs-studio#13918 ·