Вече не мога да показвам своя контролер за изглед на Modal Login, когато приложението ми се стартира след актуализирането до XCode 4.2 и iOS5. Имам приложение с 4 раздела tabBar, което изисква първоначално влизане за използване. След надграждането той просто показва първия изглед, който трябва да се покаже след влизане - по принцип никога не зарежда контролера за модален изглед, отговорен за обработката на влизането, и отива направо към другата функционалност на приложението. Абсолютно същият код, който работи в 4.3, не работи в iOS 5 - това ме озадачи! Предпочитам да не използвам StoryBoard точно сега, тъй като това трябва да работи. Поставих viewDidLoad за първия раздел на tabBar по-долу - той влиза в оператора if, но никога не показва изгледа за влизане. Наистина ще съм благодарен, ако някой може да ми помогне! Пропускам ли нещо тук? Благодаря -
ViewDidLoad:
- (void)viewDidLoad
{
// Call the super first
[super viewDidLoad];
// Only login once
PinPointMeAppDelegate *appDelegate = (PinPointMeAppDelegate *)[[UIApplication sharedApplication] delegate];
// It's not loading like it did pre-iOS5 - why?
NSLog(@"LOADING VIEW %d",appDelegate.loggedInFlag);
// Only show the login view if we aren't logged in
if (appDelegate.loggedInFlag == 0) {
// Initialize our view controller that handles logging in
ModalLogin *loginView = [[ModalLogin alloc] initWithNibName:@"ModalLogin" bundle:nil];
// Set the delegate to self
loginView.delegate = self;
// Animate presenting the nib "ModalPlace" modally
loginView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:loginView animated:NO];
// Set the flag that the modal login view is shown
self.modalShown = 1;
}
}
AppDelegateDidFinishLaunching:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Begin determining the User's Lat / Lon
// Start the Location Manager to get current coordinates to determine where the mapview should zoom
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
// Set the logged - in flag to 0 since we just launched
loggedInFlag = 0;
// Initially no alert views are shown
alertViewShown = 0;
// Initialize the splash screen to Not Shown
splashScreenFlag = 0;
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
// Set the delegate for the tabBarController
tabBarController.delegate = self;
// Un-Hide the status bar
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
return YES;
}