Convert URLRequest to NSMutableURLRequest
问题 I'm trying to convert a URLRequest to a NSMutableURLRequest in Swift 3.0 but I can't get it to work. This is the code I have: var request = self.request URLProtocol.setProperty(true, forKey: "", in: request) But it says cannot convert type URLRequest to type NSMutableURLRequest. When I try to cast using 'as' it just says the cast will always fail. What do I do? 回答1: The basics of this are get a mutable copy, update the mutable copy then update request with the mutable copy. let mutableRequest