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