UITextField canPerformAction returning NO gives serious error console messages
| Originator: | adam | ||
| Number: | rdar://15207211 | Date Originated: | 2013-10-11 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.0 |
| Classification: | Serious bug | Reproducible: | Always |
Summary: Subclassing a UITextField and overriding canPerformAction:withSender: to return NO gives errors in the console. A sample of the message is provided here. These messages do not appear if the caret is hidden by returning CGRectZero from caretRectForPosition:. Additionally, these messages only appear the first time this is done. Example console message: Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextGetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextFillRects: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Oct 11 09:42:43 Adam-Becevellos-MacBook-Pro.local CanPerformActionTest[71556] <Error>: CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. Steps to Reproduce: 1) Subclass UITextField 2) Override canPerformAction:withSender: and have it return NO for everything. 3) Ensure the subclassed text field is added to a view and is visible. 4) Run the app. 5) Tap and hold on the text field to bring up the "magnifying glass" for text selection and move the caret around. 6) Release the tap. Normally this would cause the actions to appear for the text, but since it was disabled nothing happens. 7) Notice the console messages. The console messages do not appear if you repeat these steps without first restarting the app. Expected Results: Nothing appears in the console. The API documentation does not have any restrictions on returning NO for all actions in canPerformAction:withSender: Actual Results: A lot of console messages are displayed saying that a serious error has happened due to an invalid context being used. No invalid context was used in the app, so it appears to be an issue with UITextField. Version: iOS 7.0 (tested on iOS 7.0.2 build 11A501). Configuration: Happens on both the iOS 7.0 Simulator in Xcode 5.0, and on an iPhone 5 running iOS 7.0.2 (11A501).
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!