objc2_foundation/generated/NSURLConnection.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 /// An NSURLConnection object provides support to perform
11 /// asynchronous loads of a URL request, providing data to a
12 /// client supplied delegate.
13 ///
14 ///
15 /// The interface for NSURLConnection is very sparse, providing
16 /// only the controls to start and cancel asynchronous loads of a
17 /// URL request.
18 /// <p>
19 ///
20 /// An NSURLConnection may be used for loading of resource data
21 /// directly to memory, in which case an
22 /// NSURLConnectionDataDelegate should be supplied, or for
23 /// downloading of resource data directly to a file, in which case
24 /// an NSURLConnectionDownloadDelegate is used. The delegate is
25 /// retained by the NSURLConnection until a terminal condition is
26 /// encountered. These two delegates are logically subclasses of
27 /// the base protocol, NSURLConnectionDelegate.
28 /// <p>
29 ///
30 /// A terminal condition produced by the loader will result in a
31 /// connection:didFailWithError: in the case of an error, or
32 /// connectionDidFinishLoading: or connectionDidFinishDownloading:
33 /// delegate message.
34 /// <p>
35 ///
36 /// The -cancel message hints to the loader that a resource load
37 /// should be abandoned but does not guarantee that more delegate
38 /// messages will not be delivered. If -cancel does cause the
39 /// load to be abandoned, the delegate will be released without
40 /// further messages. In general, a caller should be prepared for
41 /// -cancel to have no effect, and internally ignore any delegate
42 /// callbacks until the delegate is released.
43 ///
44 /// Scheduling of an NSURLConnection specifies the context in
45 /// which delegate callbacks will be made, but the actual IO may
46 /// occur on a separate thread and should be considered an
47 /// implementation detail.
48 /// <p>
49 ///
50 /// When created, an NSURLConnection performs a deep-copy of the
51 /// NSURLRequest. This copy is available through the
52 /// -originalRequest method. As the connection performs the load,
53 /// this request may change as a result of protocol
54 /// canonicalization or due to following redirects.
55 /// -currentRequest can be used to retrieve this value.
56 /// <p>
57 ///
58 /// An NSURLConnections created with the
59 /// +connectionWithRequest:delegate: or -initWithRequest:delegate:
60 /// methods are scheduled on the current runloop immediately, and
61 /// it is not necessary to send the -start message to begin the
62 /// resource load.
63 /// <p>
64 ///
65 /// NSURLConnections created with
66 /// -initWithRequest:delegate:startImmediately: are not
67 /// automatically scheduled. Use -scheduleWithRunLoop:forMode: or
68 /// -setDelegateQueue: to specify the context for delegate
69 /// callbacks, and -start to begin the load. If you do not
70 /// explicitly schedule the connection before -start, it will be
71 /// scheduled on the current runloop and mode automatically.
72 /// <p>
73 ///
74 /// The NSURLConnectionSynchronousLoading category adds
75 /// +sendSynchronousRequest:returningResponse:error, which blocks
76 /// the current thread until the resource data is available or an
77 /// error occurs. It should be noted that using this method on an
78 /// applications main run loop may result in an unacceptably long
79 /// delay in a user interface and its use is strongly
80 /// discourage.
81 /// <p>
82 ///
83 /// The NSURLConnectionQueuedLoading category implements
84 /// +sendAsynchronousRequest:queue:completionHandler, providing
85 /// similar simplicity but provides a mechanism where the current
86 /// runloop is not blocked.
87 /// <p>
88 ///
89 /// Both of the immediate loading categories do not provide for
90 /// customization of resource load, and do not allow the caller to
91 /// respond to, e.g., authentication challenges.
92 /// <p>
93 ///
94 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlconnection?language=objc)
95 #[unsafe(super(NSObject))]
96 #[derive(Debug, PartialEq, Eq, Hash)]
97 pub struct NSURLConnection;
98);
99
100extern_conformance!(
101 unsafe impl NSObjectProtocol for NSURLConnection {}
102);
103
104impl NSURLConnection {
105 extern_methods!(
106 #[cfg(feature = "NSURLRequest")]
107 #[deprecated = "Use NSURLSession (see NSURLSession.h)"]
108 #[unsafe(method(initWithRequest:delegate:startImmediately:))]
109 #[unsafe(method_family = init)]
110 pub unsafe fn initWithRequest_delegate_startImmediately(
111 this: Allocated<Self>,
112 request: &NSURLRequest,
113 delegate: Option<&AnyObject>,
114 start_immediately: bool,
115 ) -> Option<Retained<Self>>;
116
117 #[cfg(feature = "NSURLRequest")]
118 #[deprecated = "Use NSURLSession (see NSURLSession.h)"]
119 #[unsafe(method(initWithRequest:delegate:))]
120 #[unsafe(method_family = init)]
121 pub unsafe fn initWithRequest_delegate(
122 this: Allocated<Self>,
123 request: &NSURLRequest,
124 delegate: Option<&AnyObject>,
125 ) -> Option<Retained<Self>>;
126
127 #[cfg(feature = "NSURLRequest")]
128 #[deprecated = "Use NSURLSession (see NSURLSession.h)"]
129 #[unsafe(method(connectionWithRequest:delegate:))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn connectionWithRequest_delegate(
132 request: &NSURLRequest,
133 delegate: Option<&AnyObject>,
134 ) -> Option<Retained<NSURLConnection>>;
135
136 #[cfg(feature = "NSURLRequest")]
137 #[unsafe(method(originalRequest))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn originalRequest(&self) -> Retained<NSURLRequest>;
140
141 #[cfg(feature = "NSURLRequest")]
142 #[unsafe(method(currentRequest))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn currentRequest(&self) -> Retained<NSURLRequest>;
145
146 #[unsafe(method(start))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn start(&self);
149
150 #[unsafe(method(cancel))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn cancel(&self);
153
154 #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
155 #[unsafe(method(scheduleInRunLoop:forMode:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn scheduleInRunLoop_forMode(
158 &self,
159 a_run_loop: &NSRunLoop,
160 mode: &NSRunLoopMode,
161 );
162
163 #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
164 #[unsafe(method(unscheduleFromRunLoop:forMode:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn unscheduleFromRunLoop_forMode(
167 &self,
168 a_run_loop: &NSRunLoop,
169 mode: &NSRunLoopMode,
170 );
171
172 #[cfg(feature = "NSOperation")]
173 #[unsafe(method(setDelegateQueue:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn setDelegateQueue(&self, queue: Option<&NSOperationQueue>);
176
177 #[cfg(feature = "NSURLRequest")]
178 /// Performs a "preflight" operation that performs
179 /// some speculative checks to see if a connection can
180 /// be initialized, and the associated I/O that is
181 /// started in the initializer methods can begin.
182 ///
183 ///
184 /// The result of this method is valid only as long as
185 /// no protocols are registered or unregistered, and
186 /// as long as the request is not mutated (if the
187 /// request is mutable). Hence, clients should be
188 /// prepared to handle failures even if they have
189 /// performed request preflighting by calling this
190 /// method.
191 ///
192 ///
193 /// Parameter `request`: The request to preflight.
194 ///
195 ///
196 /// Returns: YES if it is likely that the given request can be used to
197 /// initialize a connection and the associated I/O can be
198 /// started, NO otherwise.
199 #[unsafe(method(canHandleRequest:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn canHandleRequest(request: &NSURLRequest) -> bool;
202 );
203}
204
205/// Methods declared on superclass `NSObject`.
206impl NSURLConnection {
207 extern_methods!(
208 #[unsafe(method(init))]
209 #[unsafe(method_family = init)]
210 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
211
212 #[unsafe(method(new))]
213 #[unsafe(method_family = new)]
214 pub unsafe fn new() -> Retained<Self>;
215 );
216}
217
218extern_protocol!(
219 /// Delegate methods that are common to all forms of
220 /// NSURLConnection. These are all optional. This
221 /// protocol should be considered a base class for the
222 /// NSURLConnectionDataDelegate and
223 /// NSURLConnectionDownloadDelegate protocols.
224 ///
225 ///
226 /// connection:didFailWithError: will be called at
227 /// most once, if an error occurs during a resource
228 /// load. No other callbacks will be made after.
229 /// <p>
230 ///
231 /// connectionShouldUseCredentialStorage: will be
232 /// called at most once, before a resource load begins
233 /// (which means it may be called during construction
234 /// of the connection.) The delegate should return
235 /// TRUE if the connection should consult the shared
236 /// NSURLCredentialStorage in response to
237 /// authentication challenges. Regardless of the
238 /// result, the authentication challenge methods may
239 /// still be called.
240 ///
241 /// connection:willSendRequestForAuthenticationChallenge:
242 /// is the preferred (Mac OS X 10.7 and iOS 5.0 or
243 /// later) mechanism for responding to authentication
244 /// challenges. See
245 /// <Foundation
246 /// /NSURLAuthenticationChallenge.h> for
247 /// more information on dealing with the various types
248 /// of authentication challenges.
249 ///
250 /// connection:canAuthenticateAgainstProtectionSpace:
251 /// connection:didReceiveAuthenticationChallenge:
252 /// connection:didCancelAuthenticationChallenge: are
253 /// deprecated and new code should adopt
254 /// connection:willSendRequestForAuthenticationChallenge.
255 /// The older delegates will still be called for
256 /// compatibility, but incur more latency in dealing
257 /// with the authentication challenge.
258 ///
259 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlconnectiondelegate?language=objc)
260 pub unsafe trait NSURLConnectionDelegate: NSObjectProtocol {
261 #[cfg(feature = "NSError")]
262 #[optional]
263 #[unsafe(method(connection:didFailWithError:))]
264 #[unsafe(method_family = none)]
265 unsafe fn connection_didFailWithError(&self, connection: &NSURLConnection, error: &NSError);
266
267 #[optional]
268 #[unsafe(method(connectionShouldUseCredentialStorage:))]
269 #[unsafe(method_family = none)]
270 unsafe fn connectionShouldUseCredentialStorage(&self, connection: &NSURLConnection)
271 -> bool;
272
273 #[cfg(feature = "NSURLAuthenticationChallenge")]
274 #[optional]
275 #[unsafe(method(connection:willSendRequestForAuthenticationChallenge:))]
276 #[unsafe(method_family = none)]
277 unsafe fn connection_willSendRequestForAuthenticationChallenge(
278 &self,
279 connection: &NSURLConnection,
280 challenge: &NSURLAuthenticationChallenge,
281 );
282
283 #[cfg(feature = "NSURLProtectionSpace")]
284 #[deprecated = "Use -connection:willSendRequestForAuthenticationChallenge: instead."]
285 #[optional]
286 #[unsafe(method(connection:canAuthenticateAgainstProtectionSpace:))]
287 #[unsafe(method_family = none)]
288 unsafe fn connection_canAuthenticateAgainstProtectionSpace(
289 &self,
290 connection: &NSURLConnection,
291 protection_space: &NSURLProtectionSpace,
292 ) -> bool;
293
294 #[cfg(feature = "NSURLAuthenticationChallenge")]
295 #[deprecated = "Use -connection:willSendRequestForAuthenticationChallenge: instead."]
296 #[optional]
297 #[unsafe(method(connection:didReceiveAuthenticationChallenge:))]
298 #[unsafe(method_family = none)]
299 unsafe fn connection_didReceiveAuthenticationChallenge(
300 &self,
301 connection: &NSURLConnection,
302 challenge: &NSURLAuthenticationChallenge,
303 );
304
305 #[cfg(feature = "NSURLAuthenticationChallenge")]
306 #[deprecated = "Use -connection:willSendRequestForAuthenticationChallenge: instead."]
307 #[optional]
308 #[unsafe(method(connection:didCancelAuthenticationChallenge:))]
309 #[unsafe(method_family = none)]
310 unsafe fn connection_didCancelAuthenticationChallenge(
311 &self,
312 connection: &NSURLConnection,
313 challenge: &NSURLAuthenticationChallenge,
314 );
315 }
316);
317
318extern_protocol!(
319 /// Delegate methods used for loading data to memory.
320 /// These delegate methods are all optional.
321 ///
322 ///
323 /// connection:willSendRequest:redirectResponse: is
324 /// called whenever an connection determines that it
325 /// must change URLs in order to continue loading a
326 /// request. This gives the delegate an opportunity
327 /// inspect and if necessary modify a request. A
328 /// delegate can cause the request to abort by either
329 /// calling the connections -cancel method, or by
330 /// returning nil from this callback.
331 /// <p>
332 ///
333 /// There is one subtle difference which results from
334 /// this choice. If -cancel is called in the delegate
335 /// method, all processing for the connection stops,
336 /// and no further delegate callbacks will be sent. If
337 /// the delegate returns nil, the connection will
338 /// continue to process, and this has special
339 /// relevance in the case where the redirectResponse
340 /// argument is non-nil. In this case, any data that
341 /// is loaded for the connection will be sent to the
342 /// delegate, and the delegate will receive a finished
343 /// or failure delegate callback as appropriate.
344 /// <p>
345 ///
346 /// connection:didReceiveResponse: is called when
347 /// enough data has been read to construct an
348 /// NSURLResponse object. In the event of a protocol
349 /// which may return multiple responses (such as HTTP
350 /// multipart/x-mixed-replace) the delegate should be
351 /// prepared to inspect the new response and make
352 /// itself ready for data callbacks as appropriate.
353 /// <p>
354 ///
355 /// connection:didReceiveData: is called with a single
356 /// immutable NSData object to the delegate,
357 /// representing the next portion of the data loaded
358 /// from the connection. This is the only guaranteed
359 /// for the delegate to receive the data from the
360 /// resource load.
361 /// <p>
362 ///
363 /// connection:needNewBodyStream: is called when the
364 /// loader must retransmit a requests payload, due to
365 /// connection errors or authentication challenges.
366 /// Delegates should construct a new unopened and
367 /// autoreleased NSInputStream. If not implemented,
368 /// the loader will be required to spool the bytes to
369 /// be uploaded to disk, a potentially expensive
370 /// operation. Returning nil will cancel the
371 /// connection.
372 ///
373 /// connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:
374 /// is called during an upload operation to provide
375 /// progress feedback. Note that the values may
376 /// change in unexpected ways if the request needs to
377 /// be retransmitted.
378 /// <p>
379 ///
380 /// connection:willCacheResponse: gives the delegate
381 /// an opportunity to inspect and modify the
382 /// NSCachedURLResponse which will be cached by the
383 /// loader if caching is enabled for the original
384 /// NSURLRequest. Returning nil from this delegate
385 /// will prevent the resource from being cached. Note
386 /// that the -data method of the cached response may
387 /// return an autoreleased in-memory copy of the true
388 /// data, and should not be used as an alternative to
389 /// receiving and accumulating the data through
390 /// connection:didReceiveData:
391 /// <p>
392 ///
393 /// connectionDidFinishLoading: is called when all
394 /// connection processing has completed successfully,
395 /// before the delegate is released by the
396 /// connection.
397 /// <p>
398 ///
399 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlconnectiondatadelegate?language=objc)
400 pub unsafe trait NSURLConnectionDataDelegate: NSURLConnectionDelegate {
401 #[cfg(all(feature = "NSURLRequest", feature = "NSURLResponse"))]
402 #[optional]
403 #[unsafe(method(connection:willSendRequest:redirectResponse:))]
404 #[unsafe(method_family = none)]
405 unsafe fn connection_willSendRequest_redirectResponse(
406 &self,
407 connection: &NSURLConnection,
408 request: &NSURLRequest,
409 response: Option<&NSURLResponse>,
410 ) -> Option<Retained<NSURLRequest>>;
411
412 #[cfg(feature = "NSURLResponse")]
413 #[optional]
414 #[unsafe(method(connection:didReceiveResponse:))]
415 #[unsafe(method_family = none)]
416 unsafe fn connection_didReceiveResponse(
417 &self,
418 connection: &NSURLConnection,
419 response: &NSURLResponse,
420 );
421
422 #[cfg(feature = "NSData")]
423 #[optional]
424 #[unsafe(method(connection:didReceiveData:))]
425 #[unsafe(method_family = none)]
426 unsafe fn connection_didReceiveData(&self, connection: &NSURLConnection, data: &NSData);
427
428 #[cfg(all(feature = "NSStream", feature = "NSURLRequest"))]
429 #[optional]
430 #[unsafe(method(connection:needNewBodyStream:))]
431 #[unsafe(method_family = none)]
432 unsafe fn connection_needNewBodyStream(
433 &self,
434 connection: &NSURLConnection,
435 request: &NSURLRequest,
436 ) -> Option<Retained<NSInputStream>>;
437
438 #[optional]
439 #[unsafe(method(connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:))]
440 #[unsafe(method_family = none)]
441 unsafe fn connection_didSendBodyData_totalBytesWritten_totalBytesExpectedToWrite(
442 &self,
443 connection: &NSURLConnection,
444 bytes_written: NSInteger,
445 total_bytes_written: NSInteger,
446 total_bytes_expected_to_write: NSInteger,
447 );
448
449 #[cfg(feature = "NSURLCache")]
450 #[optional]
451 #[unsafe(method(connection:willCacheResponse:))]
452 #[unsafe(method_family = none)]
453 unsafe fn connection_willCacheResponse(
454 &self,
455 connection: &NSURLConnection,
456 cached_response: &NSCachedURLResponse,
457 ) -> Option<Retained<NSCachedURLResponse>>;
458
459 #[optional]
460 #[unsafe(method(connectionDidFinishLoading:))]
461 #[unsafe(method_family = none)]
462 unsafe fn connectionDidFinishLoading(&self, connection: &NSURLConnection);
463 }
464);
465
466extern_protocol!(
467 /// Delegate methods used to perform resource
468 /// downloads directly to a disk file. All the
469 /// methods are optional with the exception of
470 /// connectionDidFinishDownloading:destinationURL:
471 /// which must be implemented in order to inform the
472 /// delegate of the location of the finished download.
473 /// This delegate and download implementation is
474 /// currently only available on iOS 5.0 or later.
475 ///
476 ///
477 /// connection:didWriteData:totalBytesWritten:expectedTotalBytes:
478 /// provides progress information about the state of
479 /// the download, the number of bytes written since
480 /// the last delegate callback, the total number of
481 /// bytes written to disk and the total number of
482 /// bytes that are expected (or 0 if this is unknown.)
483 ///
484 /// connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytes:
485 /// is called when the connection is able to resume an
486 /// in progress download. This may happen due to a
487 /// connection or network failure.
488 ///
489 /// connectionDidFinishDownloading:destinationURL: is
490 /// a terminal event which indicates the completion of
491 /// a download and provides the location of the file.
492 /// The file will be located in the applications cache
493 /// directory and is guaranteed to exist for the
494 /// duration of the delegate callback. The
495 /// implication is that the delegate should copy or
496 /// move the download to a more persistent location if
497 /// desired.
498 ///
499 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlconnectiondownloaddelegate?language=objc)
500 pub unsafe trait NSURLConnectionDownloadDelegate: NSURLConnectionDelegate {
501 #[optional]
502 #[unsafe(method(connection:didWriteData:totalBytesWritten:expectedTotalBytes:))]
503 #[unsafe(method_family = none)]
504 unsafe fn connection_didWriteData_totalBytesWritten_expectedTotalBytes(
505 &self,
506 connection: &NSURLConnection,
507 bytes_written: c_longlong,
508 total_bytes_written: c_longlong,
509 expected_total_bytes: c_longlong,
510 );
511
512 #[optional]
513 #[unsafe(method(connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytes:))]
514 #[unsafe(method_family = none)]
515 unsafe fn connectionDidResumeDownloading_totalBytesWritten_expectedTotalBytes(
516 &self,
517 connection: &NSURLConnection,
518 total_bytes_written: c_longlong,
519 expected_total_bytes: c_longlong,
520 );
521
522 #[cfg(feature = "NSURL")]
523 #[unsafe(method(connectionDidFinishDownloading:destinationURL:))]
524 #[unsafe(method_family = none)]
525 unsafe fn connectionDidFinishDownloading_destinationURL(
526 &self,
527 connection: &NSURLConnection,
528 destination_url: &NSURL,
529 );
530 }
531);
532
533/// NSURLConnectionSynchronousLoading.
534/// The NSURLConnectionSynchronousLoading category on
535/// NSURLConnection provides the interface to perform
536/// synchronous loading of URL requests.
537impl NSURLConnection {
538 extern_methods!(
539 #[cfg(all(
540 feature = "NSData",
541 feature = "NSError",
542 feature = "NSURLRequest",
543 feature = "NSURLResponse"
544 ))]
545 /// Performs a synchronous load of the given request,
546 /// returning an NSURLResponse in the given out
547 /// parameter.
548 ///
549 ///
550 /// A synchronous load for the given request is built on
551 /// top of the asynchronous loading code made available
552 /// by the class. The calling thread is blocked while
553 /// the asynchronous loading system performs the URL load
554 /// on a thread spawned specifically for this load
555 /// request. No special threading or run loop
556 /// configuration is necessary in the calling thread in
557 /// order to perform a synchronous load. For instance,
558 /// the calling thread need not be running its run loop.
559 ///
560 ///
561 /// Parameter `request`: The request to load. Note that the request is
562 /// deep-copied as part of the initialization
563 /// process. Changes made to the request argument after
564 /// this method returns do not affect the request that is
565 /// used for the loading process.
566 ///
567 ///
568 /// Parameter `response`: An out parameter which is filled in with the
569 /// response generated by performing the load.
570 ///
571 ///
572 /// Parameter `error`: Out parameter (may be NULL) used if an error occurs
573 /// while processing the request. Will not be modified if the
574 /// load succeeds.
575 ///
576 ///
577 /// Returns: The content of the URL resulting from performing the load,
578 /// or nil if the load failed.
579 #[deprecated = "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h"]
580 #[unsafe(method(sendSynchronousRequest:returningResponse:error:_))]
581 #[unsafe(method_family = none)]
582 pub unsafe fn sendSynchronousRequest_returningResponse_error(
583 request: &NSURLRequest,
584 response: Option<&mut Option<Retained<NSURLResponse>>>,
585 ) -> Result<Retained<NSData>, Retained<NSError>>;
586 );
587}
588
589/// NSURLConnectionQueuedLoading.
590/// The NSURLConnectionQueuedLoading category on NSURLConnection
591/// provides the interface to perform asynchronous loading of URL
592/// requests where the results of the request are delivered to a
593/// block via an NSOperationQueue.
594///
595/// Note that there is no guarantee of load ordering implied by this
596/// method.
597impl NSURLConnection {
598 extern_methods!(
599 #[cfg(all(
600 feature = "NSData",
601 feature = "NSError",
602 feature = "NSOperation",
603 feature = "NSURLRequest",
604 feature = "NSURLResponse",
605 feature = "block2"
606 ))]
607 /// Performs an asynchronous load of the given
608 /// request. When the request has completed or failed,
609 /// the block will be executed from the context of the
610 /// specified NSOperationQueue.
611 ///
612 ///
613 /// This is a convenience routine that allows for
614 /// asynchronous loading of a url-based resource. If
615 /// the resource load is successful, the data parameter
616 /// to the callback will contain the resource data and
617 /// the error parameter will be nil. If the resource
618 /// load fails, the data parameter will be nil and the
619 /// error will contain information about the failure.
620 ///
621 ///
622 /// Parameter `request`: The request to load. Note that the request is
623 /// deep-copied as part of the initialization
624 /// process. Changes made to the request argument after
625 /// this method returns do not affect the request that
626 /// is used for the loading process.
627 ///
628 ///
629 /// Parameter `queue`: An NSOperationQueue upon which the handler block will
630 /// be dispatched.
631 ///
632 ///
633 /// Parameter `handler`: A block which receives the results of the resource load.
634 #[deprecated = "Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h"]
635 #[unsafe(method(sendAsynchronousRequest:queue:completionHandler:))]
636 #[unsafe(method_family = none)]
637 pub unsafe fn sendAsynchronousRequest_queue_completionHandler(
638 request: &NSURLRequest,
639 queue: &NSOperationQueue,
640 handler: &block2::DynBlock<dyn Fn(*mut NSURLResponse, *mut NSData, *mut NSError)>,
641 );
642 );
643}