iOS 6.0 で作成されたこのログイン モジュールを iOS 7.0 で動作させようとしていますが、多くのエラーが発生します。使ってみalert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
ました。しかし、私はこの問題を解決する方法を本当に考えることはできません。誰かがこのコードを機能させるのを手伝ってください。これが私の現在のコードです。
「libobjc.A.dylib -[NSObject performSelector:withObject:withObject:]:"
also
"libdispatch.dylib
_dispatch_mgr_thread:」というエラーが表示されます。
NSString *message = [[NSString alloc] initWithFormat:@"Login\n\n\n"];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Enter user ID and password"
message: message
delegate: self
cancelButtonTitle: @"Cancel"
otherButtonTitles: @"OK", nil];
alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
idField = [alert textFieldAtIndex:0];
passwordField = [alert textFieldAtIndex:1];
NSLog(@"idField: %@\npasswordField: %@", idField.text, passwordField.text);
[alert addSubview:idField];
[idField becomeFirstResponder];
[alert addSubview:passwordField];
[passwordField becomeFirstResponder];
//UITextField *idField = [alert textFieldAtIndex:0];
// UITextField *passwordField = [alert textFieldAtIndex:1];
// UITextField *_textField = [message textFieldAtIndex:0];
/* commented by Uday Kanike
UITextField *text = [alert textFieldAtIndex:0];
idField = text;
[alert setDelegate:self];
[alert setTitle:@"Entry User Name..."];
[alert setMessage:@""];
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:@"OK"];
[idField setPlaceholder:@"Entry User Name..."];
idField.autocapitalizationType = UITextAutocapitalizationTypeWords;
idField.autocorrectionType = UITextAutocorrectionTypeNo;
[alert addSubview:idField];
[alert show];
[idField becomeFirstResponder];
UITextField *text1 = [alert textFieldAtIndex:1];
passwordField = text1;
[alert setDelegate:self];
[alert setTitle:@"Entry Password..."];
[alert setMessage:@""];
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:@"OK"];
[passwordField setPlaceholder:@"Entry Password..."];
[alert addSubview:passwordField];
// idField.autocapitalizationType = UITextAutocapitalizationTypeWords;
// idField.autocorrectionType = UITextAutocorrectionTypeNo;
[alert show];
[passwordField becomeFirstResponder];
[alert release];
[idField release];
[passwordField release];
*/
// NSString *title = [alert buttonTitleAtIndex:12];
// if([title isEqualToString:@"Login"])
// {
// UITextField *username = [alert textFieldAtIndex:0];
// UITextField *password = [alert textFieldAtIndex:1];
// NSLog(@"Username: %@\nPassword: %@", username.text, password.text);
// }
/*UILabel *passwordLabel = [[UILabel alloc] initWithFrame:CGRectMake(12,40,260,25)];
passwordLabel.font = [UIFont systemFontOfSize:16];
passwordLabel.textColor = [UIColor whiteColor];
passwordLabel.backgroundColor = [UIColor clearColor];
passwordLabel.shadowColor = [UIColor blackColor];
passwordLabel.shadowOffset = CGSizeMake(0,-1);
passwordLabel.textAlignment = UITextAlignmentCenter;
[alert addSubview:passwordLabel];
[passwordLabel release];
UIImageView *passwordImage = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"passwordfield" ofType:@"png"]]];
passwordImage.frame = CGRectMake(11,79,262,31);
[alert addSubview:passwordImage];
[passwordImage release];
UIImageView *passwordImage2 = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"passwordfield" ofType:@"png"]]];
passwordImage2.frame = CGRectMake(11,44,262,31);
[alert addSubview:passwordImage2];
[passwordImage2 release];*/
/*
idField = [[UITextField alloc] initWithFrame:CGRectMake(16,48,252,25)];
idField.font = [UIFont systemFontOfSize:18];
idField.backgroundColor = [UIColor whiteColor];
idField.secureTextEntry = NO;
idField.placeholder = @"User ID";
idField.keyboardAppearance = UIKeyboardAppearanceDefault;
[alert addSubview:idField];
[idField becomeFirstResponder];
passwordField = [[UITextField alloc] initWithFrame:CGRectMake(16,83,252,25)];
passwordField.font = [UIFont systemFontOfSize:18];
passwordField.backgroundColor = [UIColor whiteColor];
passwordField.secureTextEntry = YES;
passwordField.placeholder = @"Password";
passwordField.keyboardAppearance = UIKeyboardAppearanceAlert;
// passwordField.delegate = self;
alert.delegate = self;
alert.tag = 200;
[alert addSubview:passwordField];
[passwordField becomeFirstResponder];
*/
idField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"SUPUserID"];
passwordField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"SUPUserPassword"];
RequestHandler *request = [RequestHandler uniqueInstance];
[request unregisterUser];
//[alert setTransform:CGAffineTransformMakeTranslation(0,0)];
[alert show];
[alert release];
[message release];