3. MapView-click the city button. A list of available cities is displayed, but it is not reflected when you click the city button. There are no warnings or errors in the program. How can I find this problem? The best way is to use the logic reasoning of Detective thinking. For example, if you want to produce a mobile phone, you need to have dozens of processes (such as running water), and check that a mobile phone is unqualified, which leads to a problem; what should we do if there is a problem? First, we must find the problem, and find the problem to solve it. The key is to find the problem. How can we find the problem? When writing a program, the problem is pointed out by the program when warnings and errors are reported. (when writing a program, we need to have a clear structure, rigorous logic, and brains, try to know the possible problems and restrictions of the written code in advance when writing the Code). I only need to solve it, but when there is no warning or error, how can we locate the problem and solve it? In this example, I wrote a map, and now there is a problem as described above. The first thing I want to know is whether a button is associated or not. Then I will find the corresponding action of the button, // bring up the city list navigation controller-(IBAction) cityAction :( id) sender {NSLog (@ "cityAction = % @", self. navigationController); [self. navigationController presentModalViewController: self. worldCitiesListNavigationController animated: YES];} In this method, we must first obtain self. navigationController, and then get self. worldCitiesListNavigationController, and finally execute the presentModalViewController: animated: method. I will test... I went to test Step 2 first. I printed the methods and saw that they were not executed. The execution sequence was correct. Later, [940: c07] cityAction = <null> found that the first step self. navigationController was not obtained. No navigationController is initialized, and no memory is allocated to navigationController. It is empty. The problem is found. In AppDelegate. m-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {self. window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen] bounds]; self. viewController = [[ViewController alloc] initWithNibName: @ "ViewController" bundle: nil]; self. navigationController = [[UINavigationController alloc] initWithRootViewController: self. viewController]; [self. window addSubview: [navigationController view]; [self. window makeKeyAndVisible]; return YES;}. In this case, click the city button to display the city list.