New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RACCommand's executionSignals's subscribeNext block or error's block execute more times? #84
Comments
You only need to call the error's |
You shouldn't subscribe to [weakSelf.sendViewModel.sendCommand.executionSignals.switchToLatest subscribeNext:^(id x) {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = @"已发送";
[hud hide:YES afterDelay:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.view endEditing:YES];
[self dismissViewControllerAnimated:YES completion:nil];
});
}];
[weakSelf.sendViewModel.sendCommand.errors subscribeNext:^(id x) {
LJLog(@"()()()()"); // click more times the text will be loged more times
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = @"新浪服务器开小差了...";
[hud hide:YES afterDelay:1.0];
}];
[[_sendBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
NSDictionary *dict = @{@"statusd":_textView.text};
[self.sendViewModel.sendCommand execute:dict];
}]; |
ok, thank you very much. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i use RACCommand to send a network request in a sendController, you can click this controller right
barbuttomitem
, then will execute a command; if success, this sendController will be dismissed;but when fail, you know i add the log in the errors's subscribeNext block; i click
barbuttomitem
first time, the log will be show one time; but when i click at the second time, the log will be show two times; and it will always added one times if i continue click;so, i want to know is there some solution to settle this problem? thanks!
The text was updated successfully, but these errors were encountered: