0

この方法でログインメソッドを実装しました:

      [KVNProgress show];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        //some error handling like:
                if ([_usernameField.text length] < 4) {
                    [KVNProgress showErrorWithStatus:@"Username too short!"];
                    _passwordField.text = @"";
                    return;
                }
       //Then I call login web service synchronously here:
       result = [ServerRequests login];
       dispatch_async(dispatch_get_main_queue(), ^{
       if(!result)
                    {
                        [KVNProgress showErrorWithStatus:@"problem!" completion:NULL];
                        _passwordField.text = @"";
                    }
                    else if([result.successful boolValue])
                    {
                        [KVNProgress showSuccessWithStatus:result.message];

                    }

});
});

ほとんどがクラッシュし、メイン キューのみ (優先度のデフォルト キューなし) でブロックを囲むことで解決しました! しかし、問題は次のとおりです。KVNProgress は、Web サービスと呼ばれる次の部分ではなく、エラー処理領域にのみ表示されます。それはまったくユーザーフレンドリーではありません!どんなアイデアでも大歓迎です:)

4

1 に答える 1