6

收到这个奇怪的错误。

这是交易 - 在下面的方法中,我有一个警报视图出现,获取一个 U/N 和 PW,然后尝试启动另一种方法。

方法

   -postTweet

没有被激活

我只是在控制台中收到此错误

 wait_fences: failed to receive reply: 10004003

这真的很奇怪——因为我以前从未见过

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (alertView == completeAlert ) {
        if (buttonIndex ==1) {
            passPromtAlert = [[UIAlertView alloc] initWithTitle:@"Enter Name" message:@"Please enter your Username and password - they will be saved\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Tweet", nil];
            [passPromtAlert addTextFieldWithValue:@"" label:@"Enter username"];
            [passPromtAlert addTextFieldWithValue:@"" label:@"Enter password"];

            textField = [passPromtAlert textFieldAtIndex:0];
            textField2 = [passPromtAlert textFieldAtIndex:1];
            textField.clearButtonMode = UITextFieldViewModeWhileEditing;
            textField.keyboardType = UIKeyboardTypeAlphabet;
            textField.keyboardAppearance = UIKeyboardAppearanceAlert;
            textField.autocapitalizationType  = UITextAutocapitalizationTypeWords;
            textField.autocorrectionType = UITextAutocapitalizationTypeNone;
            textField.textAlignment = UITextAlignmentCenter;

            textField2.secureTextEntry = YES;

            textField2.clearButtonMode = UITextFieldViewModeWhileEditing;
            textField2.keyboardType = UIKeyboardTypeAlphabet;
            textField2.keyboardAppearance = UIKeyboardAppearanceAlert;
            textField2.autocapitalizationType  = UITextAutocapitalizationTypeWords;
            textField2.autocorrectionType = UITextAutocapitalizationTypeNone;
            textField2.textAlignment = UITextAlignmentCenter;

            [passPromtAlert show];
        }
    }
    if (alertView == passPromtAlert ) {
        if (buttonIndex == 1) {
        NSLog(@"here");         
        [self postTweet];
        }
    }
}

任何帮助,将不胜感激

谢谢

山姆

添加:

如果您需要查看更多代码,请告诉我

4

4 回答 4

6

在这里,我在我的项目中也面临同样的问题,我现在设法解决了这个问题。您需要使用 NSTimer 调用该方法。

因此,在这里,您在另一个警报中调用一个警报意味着当一个警报消失时,您将在那里调用新警报。这没有问题。你可以轻松做到。而不是在方法“- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (alertView == completeAlert )”中定义警报视图,您可以创建一种方法,例如“Show_AlertMessage”并使用类似计时器的方法调用它这。

    [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(Show_AlertMessage) userInfo:nil repeats:NO];

让我知道你是否可以摆脱这个问题。我们将像我一样解决这个问题。

于 2011-07-02T09:22:00.760 回答
1

我相信问题是由于您在关闭第一个警报视图之前创建了另一个警报视图。由于每次第二个警报视图踩到第一个警报视图时,任何人都应该只出现一个警报视图。

您需要在创建和显示第二个视图之前关闭第一个视图。

于 2010-04-16T12:54:10.483 回答
0

解决方案就在这里!我有同样的错误,现在我得到了解决方案,这可能会对你有所帮助。使用这个 AlertView 的委托

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
于 2012-10-19T13:28:22.063 回答
-1

UITextField*在解除警报之前,您不会放弃其第一响应者状态。

这弄乱了响应者链。在 UIAlertViewDelegate 实现中添加[textField resignFirstResponder][textField2 resignFirstResponder]适用 ( alertView:clickedButtonAtIndex:)

此外,安排您的第二个 UIAlertView 在第一个被解除后显示(您可以使用 ( performSelector:withObject:afterDelay:)

于 2010-04-19T07:09:25.793 回答