0

我是 iphone 开发新手。我正在创建一个地图应用程序。现在我面临警报视图的问题。要查看警报视图在模拟器中的显示方式,我在“视图确实加载”方法中添加了一个警报视图。当我单击登录页面中的一个按钮,它导航到另一个视图(显示警报视图的位置)当我运行应用程序时,在控制台窗口中,我可以看到会话在登录页面初始启动后再次启动。

用于显示警报

 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Current Location" message:@"Show Current Location?" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK"];
    [alert show];

在控制台窗口中

  [Session started at 2010-02-18 15:57:12 +0530.]

[Session started at 2010-02-18 15:57:23 +0530.]
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 604.
(gdb) 

我只是想查看警报视图而不对单击确定或取消按钮执行任何操作。请帮帮我。请指导我。谢谢。

4

1 回答 1

1

这只是调试器(gdb)的初始化。

如果调试器没有在应用程序启动时启动(如果您只是构建并运行而不是构建和调试,则会出现这种情况),调试器将在应用程序遇到问题时启动并初始化。

您在这里遇到的问题是在您的警报视图初始化行中。一切都很好,直到最后一个参数:otherButtonTitles:- 注意标题上的复数,而不是标题。这意味着该参数采用一个以 nil 结尾的项目列表 - 这也在文档中进行了说明。

你应该修改你的代码,使参数以 nil 结尾,如下所示:

 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Current Location" message:@"Show Current Location?" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
于 2010-02-18T11:56:48.653 回答