我正在尝试像这样实例化 UiAlertView:
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error"
message:@"Incorrect login or password."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
在我收到服务器的响应后,会话过期。然后应用程序让我回到登录屏幕。然后我尝试使用不正确的数据登录,但不会显示警报。相反,它会抛出这样的东西:
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed:
0 libobjc.A.dylib 0x33aa15b0 objc_msgSend + 16
1 UIKit 0x3a39a370 -[UILabel _setText:] + 92
2 UIKit 0x3a4e6648 -[UIAlertView
initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:] + 64
3 MY APP 0x00039c7e 0x34000 + 23678
4 MY APP 0x0005f784 0x34000 + 178052
5 MY APP 0x000756be 0x34000 + 267966
6 Foundation 0x347d28e8 __NSThreadPerformPerform + 456
7 CoreFoundation 0x32bbd680
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
8 CoreFoundation 0x32bbcee4 __CFRunLoopDoSources0 + 208
9 CoreFoundation 0x32bbbcb2 __CFRunLoopRun + 642
10 CoreFoundation 0x32b2eeb8 CFRunLoopRunSpecific + 352
11 CoreFoundation 0x32b2ed44 CFRunLoopRunInMode + 100
12 GraphicsServices 0x3a92c2e6 GSEventRunModal + 70
13 UIKit 0x3a3ea2f4 UIApplicationMain + 1116
14 MY APP 0x0003527e 0x34000 + 4734
15 MY APP 0x000351dc 0x34000 + 4572
是分配用@创建的字符串还是什么?
编辑:由于请求,我正在添加更多代码。我不认为服务器响应函数是相关的,因为它只是执行 x logOut 方法。顺便说一句,我发布的整个代码都放在 AppDelegate
- (void) logout
{
isLogged = NO;
currentUser = nil;
[self createNotLoggedIn];
}
然后创建 notLoggedIn 方法为登录表单创建 UIViewController。
-(void) createNotLoggedIn
{
UIViewController *loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
//UINavigationControllers are created here... stripped
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navLoginViewController, navGrafikLekarzyViewController, navPlacowkiViewController, navWiecejViewController, nil];
[self.window addSubview:self.tabBarController.view];
[self.window makeKeyAndVisible];
}
logOut 和 createNotLoggedIn 放在 AppDelegate 中