美文网首页
🐞NSInvalidArgumentException -无效的

🐞NSInvalidArgumentException -无效的

作者: js_huh | 来源:发表于2020-07-23 17:46 被阅读0次
  • Bug名称
    NSInvalidArgumentException: 无效的论点异常
    reason: (原因)
    '-[ViewController plusTotal:]: unrecognized selector sent to instance 0x7ff8d340ecb0'
  • 翻译软件:
    无法识别的选择器发送到实例0x7ff8d340ecb0
  • 我的理解:
    plusTotal:方法无法识别。
    或者说没有找到plusTotal:方法

  • Bug的产生原因?
    Terminating app due to uncaught exception 
    'NSInvalidArgumentException', reason:
    '- [ViewController plusTotal:]: 
    unrecognized selector sent to instance 0x7ff8d340ecb0'
    
    • 使用了协议, 并且在委托方调用了代理方法,可是在代理类里面没有实现代理方法
    • 所以ViewController类里面找不到plusTotal :方法

  • Bug的解决方案?
    • 在调用代理时,判断协议的方法有没有实现。respondsToSelector:
    • 在代理方VC中实现协议的方法

Bug来自于哪里?

  • iOS-MJ-UI基础-大神班/day11/购物车09-代理设计模式

创建日期: 2020.07.23

相关文章

网友评论

      本文标题:🐞NSInvalidArgumentException -无效的

      本文链接:https://www.haomeiwen.com/subject/ihlhlktx.html