龙铘
2016-05-18 04:46
采纳率: 100%
浏览 1.2k

iOS提问:'-[__NSCFDictionary icon]:

就是在viewcontroller.m里面写的九宫格界面,在从.plist文件中加载、、imageview和label的内容时报错,但是下方按钮的图片能加载出来。铜鼓这顶背景颜色也能发现其实能读出plist文件中具体有几个对象。但是就是加载不出来图片和label的值
具体报错如下
2016-05-18 12:43:25.689 应用管理[916:27757] -[__NSCFDictionary icon]: unrecognized selector sent to instance 0x7fd9b25292e0
2016-05-18 12:43:25.693 应用管理[916:27757] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary icon]: unrecognized selector sent to instance 0x7fd9b25292e0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cdb8e65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c831deb objc_exception_throw + 48
2 CoreFoundation 0x000000010cdc148d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010cd0e90a ___forwarding
_ + 970
4 CoreFoundation 0x000000010cd0e4b8 CF_forwarding_prep_0 + 120
5 应用管理 0x000000010c330e2e -[ViewController viewDidLoad] + 1470
6 UIKit 0x000000010d2fbf98 -[UIViewController loadViewIfRequired] + 1198
7 UIKit 0x000000010d2fc2e7 -[UIViewController view] + 27
8 UIKit 0x000000010d1d2ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
9 UIKit 0x000000010d1d3199 -[UIWindow _setHidden:forced:] + 282
10 UIKit 0x000000010d1e4c2e -[UIWindow makeKeyAndVisible] + 42
11 UIKit 0x000000010d15d663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
12 UIKit 0x000000010d163cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
13 UIKit 0x000000010d160e7b -[UIApplication workspaceDidEndTransaction:] + 188
14 FrontBoardServices 0x000000010fb34754 -[FBSSerialQueue _performNext] + 192
15 FrontBoardServices 0x000000010fb34ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
16 CoreFoundation 0x000000010cce4a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
_ + 17
17 CoreFoundation 0x000000010ccda95c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x000000010ccd9e13 __CFRunLoopRun + 867
19 CoreFoundation 0x000000010ccd9828 CFRunLoopRunSpecific + 488
20 UIKit 0x000000010d1607cd -[UIApplication _run] + 402
21 UIKit 0x000000010d165610 UIApplicationMain + 171
22 应用管理 0x000000010c3317af main + 111
23 libdyld.dylib 0x000000010f4f492d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 龙铘 2016-05-18 07:59

    我已经自己解决了
    把添加模块的部分改成如下代码即可顺利运行
    [self.view addSubview:appView];
    AppModel *appModle = self.apps[i];
    替换成:
    因为返回值和接收的对象搞得类型不匹配
    [self.view addSubview:appView];
    AppModel *appModle = [AppModel appModelWithDict:self.apps[i]];
    就这样,

    点赞 评论

相关推荐 更多相似问题