Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Failed Uploads Fix

オープン
#4 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CodeForPhilly/CyclePhilly-iOS-app のほかの issue

CodeForPhilly/CyclePhilly-iOS-app の issue をすべて見る

似ている issue

Objective-C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。