在我的项目中,我导入了一些第三方框架,如谷歌地图。一切编译时正常工作,但在运行时,应用程序崩溃,我可以追踪可疑的方法:initWithCoder方法在被调用时不断导致崩溃
//Invoked when the class is instantiated in XIB
-(id)initWithCoder:(NSCoder*)aDecoder
{
self = [super initWithCoder:aDecoder];
if(self)
{
[self customInitialization];
}
return self;
}
这里是崩溃我得到的堆栈:
TestMapDirections[1343:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x13ea052 0x2035d0a 0x1392a78 0x13929e9 0xae854b 0xae84d5 0x23e3f 0x23d17 0x223b0 0x2230b 0x29e5 0x2ae6 0x3d3335 0x4d1fa2 0x4d16b7 0x3d2ead 0x4d1fa2 0x4d19af 0x4d16b7 0x3d2305 0x5d884f 0x5d8dd7 0x13ebec9 0x1b75c2 0x1b755a 0x25cb76 0x25d03f 0x25c2fe 0x1dca30 0x1dcc56 0x1c3384 0x1b6aa9 0x1601fa9 0x13be1c5 0x1323022 0x132190a 0x1320db4 0x1320ccb 0x1600879 0x160093e 0x1b4a9b 0x2478 0x23d5)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
Current language: auto; currently objective-c
您可以下载my application并尝试在你的东西上,也许你可以帮助我更多地找出问题,提前thanx。
编辑: @JSON COCO:这里是customInitialization
方法的代码:
-(void)customInitialization
{
// do the initialization of class variables here..
mDirections = [UICGDirections sharedDirections];
mDirections.delegate = self;
}
更可疑'-customInitialization'方法中的代码是什么? – 2012-01-12 15:54:15
嗨@Jason:我编辑了我的帖子,另外,请尝试下载并运行我的示例,它是一个轻量级的应用程序,可能你会更好地理解我的问题:) – Malloc 2012-01-12 15:57:31
嗯,问题在于有些东西试图用一个零路径初始化一个URL。所以也许这是继承的类?继续检查每个类的'-initWithCoder:'方法的类层次结构,并找到从编码器中解压URL并尝试初始化一个ivar的类。改变这一点,以便您在尝试调用该方法之前检查解码的URL是否为零。 – 2012-01-12 16:01:01