par*_*rbo 5 uibutton ios swift
I'm wondering if this is expected behavior. I have a UIButton that has added target and a selector. The target is pure Swift object. When I try to access "allTargets" property, it ends with 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
Run Code Online (Sandbox Code Playgroud)
However when I change my target class in the way that it's superclass is NSObject, then everything works fine. The problem is that both "addTarget" and "allTargets" require type "Any", so there should be no requirements for using NSObject as Target class. Have anyone had similar issue like me?
| 归档时间: |
|
| 查看次数: |
149 次 |
| 最近记录: |