UITextField在点击时导致崩溃。只发生在一台设备上

时间:2015-09-10 06:09:33

标签: ios objective-c

所以我已经将我的应用程序发布到AppStore一段时间了,所有类型的设备都在使用它。最新版本在iPhone 6上使用ios 8.4.1以及6 +。

我收到用户的反馈,说明他何时安装了该应用,来到了登录页面, 有两个UITextField

电子邮件 - > UITextField - UIKeyboardTypeEmailAddress

passswd ---> UITextField安全类型

如果他点击电子邮件文本字段应用程序崩溃。 但如果他轻拍passwrd,那就正常了。

我已经完成了所有的可能性。 这是调用AppDelegate后得到的第一个视图,除了我分配的文本字段之外没有任何对象。此外,我无法输入凭据,无法通过此屏幕。

现在我得到他的崩溃报告

Thread : Crashed: com.apple.main-thread
0   libobjc.A.dylib                0x362cd208 bool objc::DenseMapBase<objc::DenseMap<DisguisedPtr<objc_object>, unsigned long, true, objc::DenseMapInfo<DisguisedPtr<objc_object> > >, DisguisedPtr<objc_object>, unsigned long, objc::DenseMapInfo<DisguisedPtr<objc_object> >, true>::LookupBucketFor<DisguisedPtr<objc_object> >(DisguisedPtr<objc_object> const&, std::__1::pair<DisguisedPtr<objc_object>, unsigned long> const*&) const + 3
1   libobjc.A.dylib                0x362cd3ad objc::DenseMapBase<objc::DenseMap<DisguisedPtr<objc_object>, unsigned long, true, objc::DenseMapInfo<DisguisedPtr<objc_object> > >, DisguisedPtr<objc_object>, unsigned long, objc::DenseMapInfo<DisguisedPtr<objc_object> >, true>::FindAndConstruct(DisguisedPtr<objc_object> const&) + 16
2   libobjc.A.dylib                0x362cd3ad objc::DenseMapBase<objc::DenseMap<DisguisedPtr<objc_object>, unsigned long, true, objc::DenseMapInfo<DisguisedPtr<objc_object> > >, DisguisedPtr<objc_object>, unsigned long, objc::DenseMapInfo<DisguisedPtr<objc_object> >, true>::FindAndConstruct(DisguisedPtr<objc_object> const&) + 16
3   libobjc.A.dylib                0x362cba2b objc_object::sidetable_retain() + 66
4   Foundation                     0x2874b755 +[__NSBundleTables bundleTables] + 40
5   Foundation                     0x285b49a9 +[NSBundle bundleForClass:] + 176
6   UIKit                          0x2afc03c9 -[UIWindow isInternalWindow] + 76
7   UIKit                          0x2b2540f5 +[UIWindow _enumerateWindowsIncludingInternalWindows:onlyVisibleWindows:withBlock:] + 120
8   UIKit                          0x2aff10d7 +[UIWindow allWindowsIncludingInternalWindows:onlyVisibleWindows:forScreen:] + 130
9   UIKit                          0x2aff104f +[UIWindow allWindowsIncludingInternalWindows:onlyVisibleWindows:] + 30
10  UIKit                          0x2b02ae4f -[UIViewController _window] + 238
11  UIKit                          0x2afbc7bd -[UIViewController loadViewIfRequired] + 104
12  UIKit                          0x2afbc71d -[UIViewController view] + 24
13  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
14  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
15  UIKit                          0x2afbc71d -[UIViewController view] + 24
16  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
17  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
18  UIKit                          0x2afbc71d -[UIViewController view] + 24
19  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
20  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
21  UIKit                          0x2afbc71d -[UIViewController view] + 24
22  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
23  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
24  UIKit                          0x2afbc71d -[UIViewController view] + 24
25  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
26  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
27  UIKit                          0x2afbc71d -[UIViewController view] + 24
28  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
29  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
30  UIKit                          0x2afbc71d -[UIViewController view] + 24
31  Sentieo                        0x003dd21f -[UIViewController(TLViewController) tlsw_viewDidLoad]
32  UIKit                          0x2afbc9af -[UIViewController loadViewIfRequired] + 602
33  UIKit                          0x2afbc71d -[UIViewController view] + 24

我的文字区域是:

self.loginView = [[UIView alloc] initWithFrame:CGRectMake(20.0f*widthRatio,200.0f*widthRatio, 280.0f*widthRatio,165.0f*widthRatio)];
self.loginView.backgroundColor=[UIColor colorWithRed:65/255.0 green:121/255.0 blue:173/255.0 alpha:1.0];
//25 47 70
// 5
self.loginView.layer.borderColor=[UIColor colorWithRed:25/255.0 green:47/255.0 blue:70/255.0 alpha:1.0].CGColor;
[self.loginView.layer setBorderWidth:1.0];
[self.loginView.layer setCornerRadius:5.0];
[self.view addSubview:self.loginView];
self.username = [[UITextField alloc] initWithFrame:CGRectMake(19.0f*widthRatio,10.0f*widthRatio, 241.0f*widthRatio,40.0f*widthRatio)];
self.username.borderStyle =UITextBorderStyleNone;
self.username.backgroundColor = [UIColor colorWithRed:35/255.0 green:75/255.0 blue:109/255.0 alpha:1.0];
self.username.layer.masksToBounds=YES;
self.username.layer.cornerRadius = 4.0f;
self.username.layer.borderColor = [UIColor colorWithRed:25/255.0 green:47/255.0 blue:70/255.0 alpha:1.0].CGColor;
self.username.layer.sublayerTransform = CATransform3DMakeTranslation(15, 0, 0);
UIColor *color=[UIColor colorWithRed:155/255.0 green:193/255.0 blue:228/255.0 alpha:1.0];

self.username.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"E-mail" attributes:@{NSForegroundColorAttributeName: color}];

self.username.layer.borderWidth=1.0f;
self.username.textColor = [UIColor whiteColor];
self.username.keyboardType = UIKeyboardTypeEmailAddress;
self.username.returnKeyType = UIReturnKeyNext;
self.username.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.username.delegate = self;
[self.loginView addSubview:self.username];
self.password = [[UITextField alloc] initWithFrame:CGRectMake(19.0f*widthRatio,55.0f*widthRatio, 241.0f*widthRatio,40.0f*widthRatio)];
self.password.borderStyle =UITextBorderStyleNone;
self.password.backgroundColor = [UIColor colorWithRed:35/255.0 green:75/255.0 blue:109/255.0 alpha:1.0];
self.password.layer.cornerRadius = 4.0f;
self.password.layer.borderColor = [UIColor colorWithRed:25/255.0 green:47/255.0 blue:70/255.0 alpha:1.0].CGColor;
self.password.layer.sublayerTransform = CATransform3DMakeTranslation(15, 0, 0);
self.password.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Password" attributes:@{NSForegroundColorAttributeName: color}];
self.password.layer.borderWidth=1.0f;
self.password.textColor = [UIColor whiteColor];
self.password.secureTextEntry = YES;
self.password.keyboardType = UIKeyboardTypeDefault;
self.password.returnKeyType = UIReturnKeyGo;
self.password.delegate = self;
[self.loginView addSubview:self.password];

UIViewController已设置UITextFieldDelegate 已实施textFieldShouldReturn:

我不知道如何为他删除

结论至今

1)因为没有其他人可以复制这个问题我想,这家伙需要新安装该应用程序。

2)密码和电子邮件字段之间的区别是安全=是/否    所以,如果他可能使用不同的键盘。

3)是任何通知都在触发。

Textfield委托代码

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {

    if (theTextField == self.username) {
        DataObject *obj = [DataObject getInstance];
        obj.firstlogin = true;
        // whem return key pressed on username textfield, focus shifts to password textfield
        [self.password becomeFirstResponder];
    }
    else if (theTextField == self.password) {
        [self.password resignFirstResponder];
        [self.view endEditing:YES];
        self.apiConnection=nil;
        [self login:self];
    }

    return YES;
}

0 个答案:

没有答案