oddisland
V2EX  ›  问与答

iOS Masonry 一个小问题

  •  
  •   oddisland · Sep 24, 2017 · 2038 views
    This topic created in 3152 days ago, the information mentioned may be changed or developed.

    -[UIImageView mas_makeConstraints:]: unrecognized selector sent to instance 0x7fd2efc11d70 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView mas_makeConstraints:]: unrecognized selector sent to instance 0x7fd2efc11d70' *** First throw call stack: ( 0 CoreFoundation 0x00000001053a21cb __exceptionPreprocess + 171 1 libobjc..dylib 0x0000000104d04f41 objc_exception_throw + 48 2 CoreFoundation 0x0000 ...

    请教各位 V 友

    4 replies    2017-09-25 09:48:44 +08:00
    timelessg
        1
    timelessg  
       Sep 24, 2017 via Android
    打个全局断点,沿着堆栈往上找,多半是约束不对或者层级关系不对
    expkzb
        2
    expkzb  
       Sep 24, 2017
    是不是没添加到父视图上
    paradoxs
        3
    paradoxs  
       Sep 24, 2017 via iPhone
    ……对象在报错的时候不存在。
    Jameson1559
        4
    Jameson1559  
       Sep 25, 2017
    全局断点可以捕捉到这个异常

    unrecognized selector sent to instance 0x.... 这种错误应该是最常见的错误了

    检查一下你的 block 里面是不是调用错东西了,比如不小心把 .with 写成 .width 之类的

    以及……我建议阅读一下这个
    https://stackoverflow.com/help/how-to-ask
    可以提高你提出问题的能力……光给个报错信息这种提问在 stack 上怕不是要被票死
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5638 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 08:41 · PVG 16:41 · LAX 01:41 · JFK 04:41
    ♥ Do have faith in what you're doing.