在system/bootdata目录下创建一个名为ErrRd的空文件,则程序运行过程中如果出错,则会显示出具体的错误信息,而不是"XX程序已关闭",这在模拟器和真机上都是相同的,具体的错误信息代表的涵义可以在SDK上查找,路径:
Developer Library >>API Reference >>System panic reference
例如KERN-EXEC 3,在SDK中查找结果如下:
This panic is raised when an unhandled exception occurs. Exceptions have many causes, but the most common are access violations caused, for example, by dreferencing NULL. Among other possible causes are: general protection faults, executing an invalid instruction, alignment checks, etc.
这种错误,基本上是由于访问空指针造成的.
如果是3rd的SDK,则把ErrRd文件放在Resource目录下,一样可以显示错误信息.
补充说明一点,并不是所有系统API所产生的panic都会在该目录下找到,其中一部分可能需要自己在SDK的路径下搜索头文件,来定位相应的错误