UITextViewDelegate says to use `textView:shouldInteractWithURL:inRange:forInteractionType:` which does not exist
| Originator: | m4ttcheetham | ||
| Number: | rdar://26881112 | Date Originated: | 19-Jun-2016 12:26 PM |
| Status: | Closed | Resolved: | 19-Jul-2016 03:56 PM |
| Product: | iOS SDK | Product Version: | 10.0 Beta 1 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: As of iOS 10 the method `textView:shouldInteractWithURL:inCharacterRange:` is deprecated and the header documentation deprecation warning reads "Use textView:shouldInteractWithURL:inRange:forInteractionType: instead". This method does not exist. The appropriate replacement method is `textView:shouldInteractWithURL: inCharacterRange:interaction` although attempting to use this throws the warning "nearly matches optional requirement". None of the Xcode automatic fix options satisfy the compiler. The compiler also complains that "URL" is not a recognised type which should not be true as the project is Swift 3. Steps to Reproduce: 1. Create a new Swift 3 project with the Single View Controller template 2. Add the "UITextViewDelegate" protocol to the ViewController class 3. Type "textviewshouldInteract" and let Xcode autocomplete to the "shouldInteractWith URL" method. 4. Observe warnings Expected Results: Xcode should autocomplete to a valid method and the delegate should be called when run Actual Results: Warning that method "nearly matches optional requirement" is thrown and is unsatisfiable. My attempts to discover or use the correct method have failed. It seems impossible to satisfy the warning and have the method called. Version: iOS 10.0 SDK. Xcode 8.0 beta (8S128d) Notes: I have attached a sample project that shows the warning Configuration: Xcode 8 Attachments: 'Screen Shot 2016-06-19 at 12.06.45.png' and 'Test.zip' were successfully uploaded.
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!
Apple Developer Relations
Thanks for your update.
We are closing this report.
If you see this issue again on a current release, please file a new bug report with fresh diagnostics.
If you have further questions, please update your report again at:
http://bugreport.apple.com
m4ttcheetham
Tested in Version 8.0 beta 2 (8S162m) and now behaves correctly as URL is recognised as a type for the method.
This issue has been verified as resolved and can be closed.