You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using HeapIOSAutoCapture 0.3.0 and HeapSwiftCore 0.4.0 breaks target-action usage on UITextField. When the textfield resigns first responder, something in Heap's Swizzling is sending removeTarget(self, action:"_heapControlValueChanged:event:", for: .allEvents) which is causing this issue.
Example
final class TextField: UITextField {
public convenience init() {
self.init(frame: .zero)
}
public override init(frame: CGRect) {
super.init(frame: frame)
addTarget(self, action: #selector(_didChangeText), for: .editingChanged)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc private func _didChangeText() {
print("\(#function): \(text ?? "")")
}
}
Once this TextField instance resigns first responder, _didChangeText() is never called again in subsequent editing events. This issue only appears when Heap is enabled.
Sample GIF - the text field is configured to update the label below the resign button with its text on each .editingChanged event:
Sample project demonstrating the issue: HeapTest.zip
Observed on iOS 16.4 and iOS 17, built with Xcode 14.3.1 and Xcode 15 RC1
The text was updated successfully, but these errors were encountered:
Thanks for raising this. We are currently working on a 0.4.0 release and will incorporate at fix.
A reread of the documentation shows that the action parameter does next-to-nothing on removeTarget(_:action:for:) and there's not really a safe way to call it for an object that someone else might be using as a target. (I am assuming this was an implementation bug introduced in the first version of iOS.)
This bug should be mostly confined to custom controls since they're the only ones that would be using the control as a target.
Using HeapIOSAutoCapture 0.3.0 and HeapSwiftCore 0.4.0 breaks target-action usage on UITextField. When the textfield resigns first responder, something in Heap's Swizzling is sending
removeTarget(self, action:"_heapControlValueChanged:event:", for: .allEvents)
which is causing this issue.Example
Once this
TextField
instance resigns first responder,_didChangeText()
is never called again in subsequent editing events. This issue only appears when Heap is enabled.Sample GIF - the text field is configured to update the label below the resign button with its text on each
.editingChanged
event:Sample project demonstrating the issue: HeapTest.zip
Observed on iOS 16.4 and iOS 17, built with Xcode 14.3.1 and Xcode 15 RC1
The text was updated successfully, but these errors were encountered: