<div dir="ltr">Greg -- Thanks for your interest and sorry for not getting back to you sooner.  When faced with a deadline last week, I simply modified the legacy class to run the implementation of the category method `-boolValueForKey:`, as I suggested.<div><br></div><div>Now that I have a brief opportunity, I tried to reproduce the failure in a test project, and naturally I couldn&#39;t.  (I did a dummy implementation of the remote object proxy that created an NSDictionary and passed it to a handler block. This mimics the original code, where the dictionary is being returned as the result of an XPC call to another process.)</div><div><br></div><div>If I get a chance to resurrect the original implementation so I can record the exact runtime exception message, I will. Right now I&#39;m busy preparing to go to WWDC for the first time in a decade. (Will you be available, by any chance?)</div><div><br></div><div>Thanks again -- Russell</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 24, 2017 at 6:03 PM, Greg Parker <span dir="ltr">&lt;<a href="mailto:gparker@apple.com" target="_blank">gparker@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><span class=""><br><div><br><blockquote type="cite"><div>On May 23, 2017, at 1:10 PM, Russell Finn via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:</div><br class="m_3691543496432460958Apple-interchange-newline"><div><div dir="ltr"><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica">I&#39;m having an issue with an NSDictionary that is passing through Swift code and back to Objective-C losing access to a method implemented by a category on NSDictionary. There is clearly some subtlety about bridged dictionaries that I&#39;m missing, and I&#39;d appreciate any clarification that the list can provide.</div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica"><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica">Specifically: I have a Swift 3 application that uses some legacy Objective-C classes.  One of these classes relies on a category on NSDictionary that implements a method called `-boolValueForKey:`.  </div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica">In the main application, the Swift code calls a method on a remote object proxy that returns an NSDictionary, which get bridged back to a Swift dictionary (`[AnyHashable: Any]`).  This bridged dictionary is passed to a method on the legacy Objective-C class that calls the `-boolValueForKey:` method from the category.  At this point, a runtime exception occurs that says the dictionary object (which at this point is a `_SwiftDeferredNSDictionary`, according to the debugger) doesn’t recognize the selector `-boolValueForKey:`.</div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica">I can work around the issue in my code by modifying the legacy Objective-C class and inlining the implementation of `-boolValueForKey:` — but is there a better general approach?</div></div></div></blockquote><br></div></span><div>This should work. _SwiftDeferredNSDictionary is a subclass of NSDictionary and should inherit all of NSDictionary&#39;s categories.</div><div><br></div><div>What is the exact exception you get?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>-- </div><div>Greg Parker     <a href="mailto:gparker@apple.com" target="_blank">gparker@apple.com</a>     Runtime Wrangler</div><div><br></div><div><br></div></font></span></div></blockquote></div><br></div>