我试图执行一个NSURLProtocol如下面的教程解释说:http://www.raywenderlich.com/76735/using-nsurlprotocol-swiftNSURLProtocol和迅速 - 错误ios7
一切工作正常与iOS8上,但在iOS7我startLoading得到一个运行时错误()。
override func startLoading() {
var newRequest = self.request.copy() as NSMutableURLRequest //<- this line fails
NSURLProtocol.setProperty(true, forKey: "MyURLProtocolHandledKey", inRequest: newRequest)
self.connection = NSURLConnection(request: newRequest, delegate: self)
}
错误:WebCore的:CFNetwork的装载机(10):EXC_BREAKPOINT
有谁有成功实施了NSURLProtocol?谢谢!
如果你使用'var newRequest = self.request.mutableCopy()作为NSMutableURLRequest',它会起作用吗?因为我不希望copy()返回一个可变的请求。 – 2014-10-03 14:01:39
感谢马特,这是工作! – Reinhold 2014-10-08 08:26:14
很酷;我已经添加了这个答案。 – 2014-10-08 09:25:59