如何调试CUICatalog:提供的资产名称无效:(null)

san*_*ana 5 iphone ios xcode6

我正在使用xib来制作我的某个应用程序的UI.我在控制台中收到与"CUICatalog:提供的资产名称无效:( null)"相关的几个警告.从研究中我了解到,如果我们在xib中提供错误的图像名称,则会发生此错误.但是在这里我想知道是否有任何方法可以指出该地方抛出该错误,xib名称或错误的图像名称等.

小智 1

我刚刚修复了这个错误。只需检查函数 [UIImage imageNamed:(NSString*) imageName] 的用法即可。如果 imageName 为零,则会发生错误。

在我的代码中:

UIImageView*imageView=[[UIImageView alloc]initWithFrame:frame];

    if (imageName!=nil) {
        imageView.image=[UIImage imageNamed:imageName];
    }
Run Code Online (Sandbox Code Playgroud)