我已将图像文件(png)添加到我的项目中。编译我的应用程序,它都工作。现在我删除了图像文件,清理了构建目标并再次编译。一切都编译但应用程序无法启动。我只看到码头上的跳跃图标。 Xcode说:
__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__
任何人都可以帮助我吗?感谢。
这是调试器所说的(是的,应用程序被称为'我的PC LOAD LETTER'):
[Session started at 2009-08-18 15:06:27 +0200.]
2009-08-18 15:06:27.792 My PC LOAD LETTER[1435:10b] An uncaught exception was raised
2009-08-18 15:06:27.793 My PC LOAD LETTER[1435:10b] *** -[NSCFArray objectAtIndex:]: index (3) beyond bounds (2)
2009-08-18 15:06:27.793 My PC LOAD LETTER[1435:10b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (3) beyond bounds (2)'
2009-08-18 15:06:27.794 My PC LOAD LETTER[1435:10b] Stack: (
2494636011,
2491268667,
2494635467,
2494635530,
2455154639,
2454620040,
2467614489,
2467616211,
8392,
2494695413,
2466250126,
2466209722,
2466208028,
2466207071,
2466206877,
2466206028
)
[Session started at 2009-08-18 15:06:27 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 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 1435.
kill
The Debugger Debugger is attaching to process
[Session started at 2009-08-18 15:06:32 +0200.]
2009-08-18 15:06:32.897 My PC LOAD LETTER[1446:10b] An uncaught exception was raised
2009-08-18 15:06:32.898 My PC LOAD LETTER[1446:10b] *** -[NSCFArray objectAtIndex:]: index (3) beyond bounds (2)
2009-08-18 15:06:32.898 My PC LOAD LETTER[1446:10b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (3) beyond bounds (2)'
2009-08-18 15:06:32.899 My PC LOAD LETTER[1446:10b] Stack: (
2494636011,
2491268667,
2494635467,
2494635530,
2455154639,
2454620040,
2467614489,
2467616211,
8392,
2494695413,
2466250126,
2466209722,
2466208028,
2466207071,
2466206877,
2466206028
)
[Session started at 2009-08-18 15:06:32 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 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 1446.
(gdb)
我一直有删除图像/声音/等文件的问题。也在Visual Studio中。
我使用图像的文件名作为tabview选项卡的标识符,这是UKPrefsPanel的tabView插座。
答案 0 :(得分:1)
检查以确保您没有在代码中的任何位置引用该文件(或Info.plist)。
答案 1 :(得分:1)
如果您放回PNG,它是否会编译并再次运行?如果没有,那么清除构建环境会有点过多。
<小时/> 啊,Q中有更多评论,所以A中有更多文字...
“超出界限(2)的索引(3)”表明存在索引问题。你有没有把这个索引值硬编码?或者将索引值存储在配置文件中?我可以想象你有例如存储的文件列表和通过删除PNG,此列表变为一个较小的项目,但索引可能不会反映这一点,因此它仍然引用项目3,它不再存在。 检查您使用数组的位置的代码,并确保索引始终在此数组的范围内。当超出范围但不依赖代码来自行检查时,提出自定义异常。 (换句话说,应用防御性编程。)