Post

Replies

Boosts

Views

Activity

Previews not supported for watchOS target Widget extension
I'm trying to add a watchOS app and watch widgets to an existing iOS project, similar to what's shown in wwdc2022-10050. The widget works fine when I select the iOS scheme, but when I switch over to the watchOS widget scheme, Xcode fails to generate a preview and gives this error. I'm not sure how to enable support for previews properly. UnsupportedProductTypeError: Previews not supported for WeatherNewWidget Watch Previews can be defined in applications, frameworks, Swift packages, or dynamic libraries productType = com.apple.product-type.extensionkit-extension buildable = WeatherNewWidget Watch.appex
1
3
1.2k
Jun ’22
WeatherKit iOS SDK 401 network error
I'm following along to the WWDC WeatherKit session, and I keep getting this 401 network error that causes my app to crash on a fatal error. I have already created the proper Bundle App ID with WeatherKit enabled, and added the WeatherKit capability. Here is my code: private func getWeather() async -> Double {         let weatherService = WeatherService()         let syracuse = CLLocation(latitude: 33.6846, longitude: 117.8265)         let weather = try! await weatherService.weather(for: syracuse)         let temperature = weather.currentWeather.temperature         return temperature.converted(to: .celsius).value     } Full error message: 2022-06-07 17:35:43.051776-0700 WWDC2022[56529:1296409] WWDC2022/WeatherView.swift:30: Fatal error: 'try!' expression unexpectedly raised an error: WeatherDaemon.WDSHMACJWTAuthenticatorService.Errors.invalidJWTResponse(Optional(<NSHTTPURLResponse: 0x6000018402c0> { URL: https://weather-data.apple.com/v2/token } { Status Code: 401, Headers {     Connection =     (         close     );     "Content-Length" =     (         0     );     Date =     (         "Wed, 08 Jun 2022 00:35:43 GMT"     );     Server =     (         Apple     );     "Strict-Transport-Security" =     (         "max-age=31536000; includeSubdomains"     );     "X-Apple-Origin" =     (         "8961098f-b238-3714-ba44-5b569c861456"     );     "X-Cache" =     (         "TCP_MISS from a23-219-38-54.deploy.akamaitechnologies.com (AkamaiGHost/10.8.2-41841244) (-)"     );     "X-Content-Type-Options" =     (         nosniff     );     "X-Frame-Options" =     (         SAMEORIGIN     );     "X-REQUEST-ID" =     (         "5156c5c7-d23b-4a66-a161-c8a9fb849c85"     );     "X-XSS-Protection" =     (         "1; mode=block"     ); } }))
26
10
6.7k
Jun ’22