我想知道这是否是预期的行为。我有一个添加了目标和选择器的UIButton。目标是纯Swift对象。当我尝试访问" allTargets"属性,以EXC_BAD_INSTRUCTION结尾:
dylib 0x000000010d10d2a0 _TFs26_forceBridgeFromObjectiveCurFTPs9AnyObject_Mx_x + 384", "4
libswiftFoundation.dylib 0x000000010d1152af _TFZFE10FoundationVs3Set26_forceBridgeFromObjectiveCFTCSo5NSSet6resultRGSqGS0_x___T_U_FTP_GSpV10ObjectiveC8ObjCBool__T_ + 111", "5
libswiftFoundation.dylib 0x000000010d1153b4 _TTRgRxs8HashablerXFo_iP_dGSpV10ObjectiveC8ObjCBool___XFdCb_dPs9AnyObject_dGSpS1____ + 164", "6
CoreFoundation 0x000000010a41c0ef __51-[__NSSetM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 79", "7
CoreFoundation 0x000000010a41c00a -[__NSSetM enumerateObjectsWithOptions:usingBlock:] + 202", "8
libswiftFoundation.dylib 0x000000010d1161c7 _TZFE10FoundationVs3Set36_unconditionallyBridgeFromObjectiveCfGSqCSo5NSSet_GS0_x_ + 535", "9
然而,当我以他们的超类是NSObject的方式改变我的目标类时,一切正常。问题是" addTarget"和#34;所有目标"要求类型"任何",所以不应该将NSObject用作Target类。有没有像我这样的问题?