Github user ginamdar commented on the pull request:

    
https://github.com/apache/cordova-plugin-dialogs/pull/39#issuecomment-65650770
  
    im not using text fields inside my projects but this works with dialogboxes 
on iOS8 without inputs fields 
    
    if (![self isAlertViewSupported]) {
            CDVAlertViewController *alert = [CDVAlertViewController 
alertControllerWithTitle:title
                                                                                
     message:message
                                                                              
preferredStyle:UIAlertControllerStyleAlert];
            alert.alertViewCtrlCallBackId = callbackId;
            NSUInteger count = [buttons count];
    
            for (int n = 0; n < count; n++) {
                UIAlertAction *actionWithTitle = [UIAlertAction 
actionWithTitle:[buttons objectAtIndex:n]
                                                                          
style:UIAlertActionStyleDefault
                                                                        
handler:^(UIAlertAction *action) {
                    CDVPluginResult*  result;
    
                    UITextField *textField = [alert.textFields firstObject];
    
                    if (textField) {
                        NSString *value0 = textField.text;
                        NSDictionary* info = @{
                                               @"buttonIndex":@(n),
                                               @"input1":(value0 ? value0 : 
[NSNull null])
                                               };
                        result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK
                                               messageAsDictionary:info];
                    }else{
    
                        result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_OK
                                                      messageAsInt:(int)(n + 
1)];
                    }
                    [self.commandDelegate sendPluginResult:result
                                                
callbackId:alert.alertViewCtrlCallBackId];
    
                }];
                [alert addAction:actionWithTitle];
            }
    
            if ([dialogType isEqualToString:DIALOG_TYPE_PROMPT]) {
                [alert addTextFieldWithConfigurationHandler:^(UITextField 
*textField) {
                    textField.placeholder = defaultText ;
                }];
            }
            [self.viewController presentViewController:alert animated:YES 
completion:nil];
      }else{
       //existing ios7 and older code?
    }
    
    - (BOOL)isAlertViewSupported
    {
        if([[UIDevice currentDevice].systemVersion compare:@"8.0" 
options:NSNumericSearch] == NSOrderedDescending){
            return NO;
        }else{
            return YES;
        }
    }
    ...
    
    @implementation CDVAlertViewController
    
    @synthesize alertViewCtrlCallBackId;
    
    @end


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to