macOS WeatherKit "A server with the specified hostname could not be found"

My code was running with with the version before Xcode 26 RC. I recompiled one last time. Now I'm getting the error: A server with the specified hostname could not be found

            let now = Calendar.current.date(byAdding: .hour, value: 1, to: Date())!
            let nextWeek = Calendar.current.date(byAdding: .day, value: 14, to: Date())!
			do
			{
                let (dailyForecast, hourlyForecast, currentWeather, alertWeather) =
                    try await weatherService.weather(for: thisLocation, including: .daily, .hourly(startDate: now, endDate: nextWeek), .current, .alerts)

Suggestions?

Answered by EdwardD20 in 860089022

Somehow my Outgoing Connection got turned off. Turned it back on and I'm back in business.

Sorry for a missing first statement:

let thisLocation = CLLocation(latitude: lat, longitude: long)

Here is the same code in Swift Playground format:

//import Cocoa
//import Foundation
import WeatherKit
import CoreLocation

var token = [String]()
let escapedCity = "41.736,-88.095"
token = escapedCity.components(separatedBy: ",")
let weatherService = WeatherService()
let lat = Double(token[0])!
let long = Double(token[1])!

let thisLocation = CLLocation(latitude: lat, longitude: long)
let now = Calendar.current.date(byAdding: .hour, value: 1, to: Date())!
let nextWeek = Calendar.current.date(byAdding: .day, value: 14, to: Date())!
do
{
    let (dailyForecast, hourlyForecast, currentWeather, alertWeather) =
        try await weatherService.weather(for: thisLocation, including: .daily, .hourly(startDate: now, endDate: nextWeek), .current, .alerts)
    print(String(format: "%.0f", currentWeather.temperature.converted(to: .fahrenheit).value))
    print(String(format: "%.0f", hourlyForecast.count))
    print(String(format: "%.0f", dailyForecast.count))
    print(String(format: "%.0f", alertWeather?.count ?? 0))
    }
    catch
    {
        print(String(format:" Weather try/catch1 error: %@", error.localizedDescription))
        print(String(format:" Weather full service not available: %.3f,%.3f", lat, long))
    }

And returns the message: remoteProcessWasInterrupted

Here is the same code in Swift Playground:

//import Cocoa
//import Foundation
import WeatherKit
import CoreLocation

var token = [String]()
let escapedCity = "41.736,-88.095"
token = escapedCity.components(separatedBy: ",")
let weatherService = WeatherService()
let lat = Double(token[0])!
let long = Double(token[1])!

let thisLocation = CLLocation(latitude: lat, longitude: long)
let now = Calendar.current.date(byAdding: .hour, value: 1, to: Date())!
let nextWeek = Calendar.current.date(byAdding: .day, value: 14, to: Date())!
do
{
    let (dailyForecast, hourlyForecast, currentWeather, alertWeather) =
        try await weatherService.weather(for: thisLocation, including: .daily, .hourly(startDate: now, endDate: nextWeek), .current, .alerts)
    print(String(format: "%.0f", currentWeather.temperature.converted(to: .fahrenheit).value))
    print(String(format: "%.0f", hourlyForecast.count))
    print(String(format: "%.0f", dailyForecast.count))
    print(String(format: "%.0f", alertWeather?.count ?? 0))
    }
    catch
    {
        print(String(format:" Weather try/catch1 error: %@", error.localizedDescription))
        print(String(format:" Weather full service not available: %.3f,%.3f", lat, long))
    }

Returning the message:

remoteProcessWasInterrupted

Accepted Answer

Somehow my Outgoing Connection got turned off. Turned it back on and I'm back in business.