我正在尝试将数据发布到数据库,但问题是我似乎无法从用户那里获取在 UIAlertView 中输入的文本。我尝试了许多解决方案,例如子查看 UITextField,但没有运气。这是我当前的简单配置。如果您需要更多信息,请与我们联系。
- (void)viewDidLoad
{
[super viewDidLoad];
//load site in webview
NSURLRequest *siteRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://google.com/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
[webview loadRequest:siteRequest];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Please enter your email address." delegate:self cancelButtonTitle:@"Submit" otherButtonTitles:@"Skip", nil];
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField *emailInput = [alertView textFieldAtIndex:0];
[alertView show];
emails=emailInput.text;
// NSLog(emails);
phone=@"8675309";
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}