Issue with PushViewController in viewDidAppear

I needed to push another ViewController (SecondViewController) from the viewDidAppear method of a ViewController (FirstViewController), so I used the following code: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; UIViewController *secondViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"]; [self.navigationController pushViewController:secondViewController animated:YES]; } In iOS 8, this code works well. When FirstViewController appears, SecondViewController is pushed immediately, and even if the animated parameter is YES, the push animation does not display. However, in iOS 7, the situation is different. It seems that the pushViewController method does not execute, and SecondViewController is not pushed. Breakpoints show that the pushViewController method is indeed executed, but there is no effect on the interface. ...

March 13, 2015 · 1 min · Zhiya

Using TestFlight for App Beta Testing

TestFlight has been integrated into iTunes Connect by Apple, making it very convenient to conduct beta testing for apps. Here’s an introduction on how to use TestFlight for testing, along with some minor issues you might encounter. First, you need to enable TestFlight in iTunes Connect. You can decide whether to enable TestFlight for a specific version of each app. Go to iTunes Connect -> My Apps -> a specific app -> Prerelease, and in the upper right corner of the uploaded build, turn on the TestFlight switch. This will start TestFlight for that version. ...

October 30, 2014 · 3 min · Zhiya

Perfect Combination of LaunchImage and LaunchScreen in iOS8

In iOS8, Apple introduced LaunchScreen.xib to replace the previous LaunchImage as the app’s launch interface. Compared to LaunchImage, LaunchScreen.xib is undoubtedly more convenient with AutoLayout, especially as iOS device screen sizes become increasingly diverse. Otherwise, an app compatible with iPhone5 to iPhone6Plus would require four different sizes of LaunchImages. However, LaunchScreen is only supported in iOS8, so some developers still choose the traditional LaunchImage method. There’s also a way to combine LaunchImage and LaunchScreen: using LaunchScreen for larger iPhones (iPhone6 and iPhone6Plus, which both run iOS8) and LaunchImage for iOS7 (since iOS7 phones only include 4-inch and 5.5-inch iPhones, only two images are needed). ...

October 25, 2014 · 1 min · Zhiya

Exploring Push Notification Registration Failures in iOS8

Apple officially released iOS8 on September 18th. Upon updating, I discovered that my app could not launch on iOS8. The Console displayed the following message: 2014-09-19 16:26:20.369 demo[379:30506] registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later. Upon checking the documentation, I found that the method registerForRemoteNotificationTypes used for registering push notifications has been deprecated in iOS8. The documentation states: Following the documentation’s guidance, I replaced it with the registerForRemoteNotifications method, which does not accept any parameters. However, this led to a new issue: the app could successfully register on devices where it was already installed, but failed to register on newly installed iOS8 devices. Neither application:didRegisterForRemoteNotificationsWithDeviceToken: nor application:didFailToRegisterForRemoteNotificationsWithError: responded, and on devices where registration was successful, push notifications were received without sound alerts. Further review of the documentation revealed the following: ...

September 19, 2014 · 2 min · Zhiya

iOS6 Screen Rotation Issue

When creating xib files using the iOS6 SDK, AutoLayout is enabled by default. AutoLayout is a new feature introduced in iOS6 that allows for automatic layout through relative positioning, adapting to various screen resolutions (as iOS device resolutions are likely to become more diverse). If a project using AutoLayout is run on systems below iOS6, the program will encounter errors. Therefore, by disabling the AutoLayout option in all xib files and running the project again, it was found that projects originally set to display in landscape mode had switched to portrait mode, rendering all landscape settings ineffective. The solution is to add the following code in the Controller where landscape mode is needed. It’s best to set self.window as a RootViewController and then add the following code in the RootViewController: ...

May 21, 2013 · 1 min · Zhiya