Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
Solicitud de URLSession: código de solicitud = -1009 "(null)" UserInfo = {_NSURLErrorNWPathKey = insatisfecho (denegado a través de la interfaz celular)

La prueba se realiza en iPhone 13 Pro 15.3.1, con Xcode 13.2.1. He reducido el problema de la siguiente manera dos pruebas. El siguiente código de prueba solo envía una simple solicitud https.

He permitido el acceso a la red para la aplicación de prueba tanto en Wifi como en celular. Y soy un desarrollador pagado.

Las siguientes dos pruebas se aprobaron en el simulador pero fallaron en el iPhone, por lo que significa que algo anda mal en el lado de mi iPhone, busque una publicación que diga que el iPhone de la marca China puede tener este problema, sigo investigando... orz

El error existe con WiFi y Cellular. La solicitud de URLSession se deniega tanto en la interfaz Wi-Fi como en la interfaz celular.

NSURLErrorNWPathKey=unsatisfied... ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

1ra prueba:

El código de prueba se proporciona en el documento de Apple ( https://developer.apple.com/documentation/xctest/asynchronous_tests_and_expectations/testing_asynchronous_operations_with_expectations ).

 func testDownloadWebData() { // Create an expectation for a background download task. let expectation = XCTestExpectation(description: "Download apple.com home page") // Create a URL for a web page to be downloaded. let url = URL(string: "https://apple.com")! // Create a background task to download the web page. let dataTask = URLSession.shared.dataTask(with: url) { (data, _, _) in // Make sure we downloaded some data. XCTAssertNotNil(data, "No data was downloaded.") // Fulfill the expectation to indicate that the background task has finished successfully. expectation.fulfill() } // Start the download task. dataTask.resume() // Wait until the expectation is fulfilled, with a timeout of 10 seconds. wait(for: [expectation], timeout: 10.0) }

2do intento:

También pruebo mi versión, pero obtengo el mismo resultado.

 func testDownloadWebData() { // Create an expectation for a background download task. let expectation = expectation(description: "Download apple.com home page") // Create a URL for a web page to be downloaded. let url = URL(string: "https://apple.com")! var request = URLRequest(url: url) request.httpMethod = "GET" let config = URLSessionConfiguration.default config.waitsForConnectivity = true let session = URLSession(configuration: config) // Create a background task to download the web page. let dataTask = session.dataTask(with: request) { (data, _, error) in // put a breakpoint here, no triggered. guard error == nil else { print(error!.localizedDescription) return } // Make sure we downloaded some data. XCTAssertNotNil(data, "No data was downloaded.") // Fulfill the expectation to indicate that the background task has finished successfully. expectation.fulfill() } // Start the download task. dataTask.resume() // Wait until the expectation is fulfilled, with a timeout of 10 seconds. wait(for: [expectation], timeout: 10.0) }
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!