WeatherKit

RSS for tag

Bring weather information to your apps and services through a wide range of data that can help people stay up to date, safe, and prepared.

Posts under WeatherKit tag

59 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Help Needed: WeatherKit Entitlement Not Recognized in iOS App
大家好, 我目前正在开发一个需要使用WeatherKit的iOS应用程序。我已在我的aioutfit3.entitlements文件中添加了必要的权限,如下所示: <?xml版本="1.0"编码="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist版本="1.0"> <字典> <键>com.apple.developer.weatherkit</键> <真实/> </字典> 尽管如此,当我试图获取天气数据时,该应用程序报告说它找不到授权文件,并特别提到WeatherKit授权缺失。以下是日志输出的一部分: ❌未找到权利文件 📱捆绑ID:com.superhuang.aioutfit3 ❌未找到WeatherKit权利 我已确认授权文件在Xcode项目中配置正确,并已尝试清理和重建该项目。然而,这个问题仍然存在。 有人遇到过类似的问题吗?或者有人有可能有助于解决这个问题的建议吗?非常感谢您的帮助! 我希望这个帖子的内容能帮助你在论坛上找到解决方案。如果您需要更多信息或修改,请告诉我! 一些图片
1
0
83
5d
Unable to add WeatherKit in Xcode 16
Hello fellow developers, I’m posting this short message because I’m trying to add WeatherKit to my application, but I’m running into a problem. I have correctly declared my application on Apple’s website under Certificates, IDs & Profiles, and I have checked WeatherKit. However in Xcode, I do not have the option to add WeatherKit in Signing & Capabilities. The option doesn’t appear even though I have the Automatically manage signing box checked. What can I do to resolve this issue? Thank you for your response.
2
0
254
Oct ’24
WeatherKit moonPhase:full is skipped
HI there, when requesting the daily forecast via the WeatherKit REST API, I found out that under certain circumstances the moon phase full is skipped. Example from Japan (working): { "forecastDaily": { "name": "DailyForecast", "metadata": { "attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/", "expireTime": "2024-10-21T15:16:10Z", "latitude": 35.650, "longitude": 139.840, "readTime": "2024-10-21T14:16:10Z", "reportedTime": "2024-10-21T12:00:37Z", "units": "m", "version": 1, "sourceType": "modeled" }, "days": [ ..., { "forecastStart": "2024-10-16T15:00:00Z", "forecastEnd": "2024-10-17T15:00:00Z", "conditionCode": "MostlyCloudy", "maxUvIndex": 4, "moonPhase": "waxingGibbous", "moonrise": "2024-10-17T07:47:26Z", "moonset": "2024-10-16T20:09:01Z", "precipitationAmount": 0.09, "precipitationChance": 0.43, "precipitationType": "rain", ... "windSpeedMax": 16.03, }, { "forecastStart": "2024-10-17T15:00:00Z", "forecastEnd": "2024-10-18T15:00:00Z", "conditionCode": "Rain", "maxUvIndex": 4, "moonPhase": "full", "moonrise": "2024-10-18T08:20:34Z", "moonset": "2024-10-17T21:24:49Z", "precipitationAmount": 4.83, "precipitationChance": 0.83, "precipitationType": "rain", ... "windSpeedMax": 15.57, }, { "forecastStart": "2024-10-18T15:00:00Z", "forecastEnd": "2024-10-19T15:00:00Z", "conditionCode": "Drizzle", "maxUvIndex": 5, "moonPhase": "waningGibbous", "moonrise": "2024-10-19T08:58:43Z", "moonset": "2024-10-18T22:42:03Z", "precipitationAmount": 3.85, "precipitationChance": 0.76, ... "windSpeedMax": 28.81, }, ... ] } } Example from Germany where the fullmoon is skipped: { "forecastDaily": { "name": "DailyForecast", "metadata": { "attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/", "expireTime": "2024-10-21T15:41:17Z", "latitude": 47.760, "longitude": 12.650, "readTime": "2024-10-21T14:41:17Z", "reportedTime": "2024-10-21T13:00:37Z", "units": "m", "version": 1, "sourceType": "modeled" }, "days": [ { "forecastStart": "2024-10-16T22:00:00Z", "forecastEnd": "2024-10-17T22:00:00Z", "conditionCode": "MostlyClear", "maxUvIndex": 3, "moonPhase": "waxingGibbous", "moonrise": "2024-10-17T16:07:30Z", "moonset": "2024-10-17T05:19:30Z", "precipitationAmount": 0.0, ... "windSpeedMax": 8.23, }, { "forecastStart": "2024-10-17T22:00:00Z", "forecastEnd": "2024-10-18T22:00:00Z", "conditionCode": "Cloudy", "maxUvIndex": 2, "moonPhase": "waningGibbous", "moonrise": "2024-10-18T16:30:22Z", "moonset": "2024-10-18T06:48:39Z", "precipitationAmount": 1.17, ... "windSpeedMax": 8.73, }, { "forecastStart": "2024-10-18T22:00:00Z", "forecastEnd": "2024-10-19T22:00:00Z", "conditionCode": "Cloudy", "maxUvIndex": 2, "moonPhase": "waningGibbous", "moonrise": "2024-10-19T16:59:14Z", "moonset": "2024-10-19T08:18:33Z", "precipitationAmount": 0.02, ... "windSpeedMax": 7.16, }, ] } } As you can see here https://moon.nasa.gov/moon-observation/daily-moon-guide/?intent=011#1729171951907::0:: and on several other sites specialized on the lunar cycle) on 2024-10-17 should be shown full moon. I know this error is probably because the forecast starts prior to the full moon phase and ends after it but customers don't care about technicalities. They see that there is a full moon missing and complain to me. And they are right. Can you fix this somehow? For example, if a DailyForecast spans the majority of a full moon this Day is marked as full moon. Another question: Are you considering providing a moonPhase attribute to the "currentWeather" dataset? That would be the best option. (At least for me :))
1
2
148
Oct ’24
MISSING_AUTH REST response?
I haven't gotten any hits searching for this, so I decided to open a new thread. The Tech Note that was mentioned in an earlier 2024 thread doesn't mention this error. I've been trying different ways to get a token, and finally found this article that seems to be in the correct format. https://dev.to/hasone/generate-jwt-token-for-apple-store-connect-api-using-python-3j5h The Apple App Store Server Swift Library was supposed to have a createJWT() method, but it's gone now. curl -v -H 'Authorization: Bearer [token]' "https://weatherkit.apple.com/api/v1/availability/37.323/122.032?country=US" Host weatherkit.apple.com:443 was resolved. IPv6: (none) IPv4: 23.66.3.87, 23.66.3.70, 23.66.3.74, 23.66.3.72, 23.66.3.81, 23.66.3.75, 23.66.3.91, 23.66.3.71, 23.66.3.73 Trying 23.66.3.87:443... Connected to weatherkit.apple.com (23.66.3.87) port 443 ALPN: curl offers h2,http/1.1 (304) (OUT), TLS handshake, Client hello (1): CAfile: /etc/ssl/cert.pem CApath: none (304) (IN), TLS handshake, Server hello (2): (304) (IN), TLS handshake, Unknown (8): (304) (IN), TLS handshake, Certificate (11): (304) (IN), TLS handshake, CERT verify (15): (304) (IN), TLS handshake, Finished (20): (304) (OUT), TLS handshake, Finished (20): SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF ALPN: server accepted http/1.1 Server certificate: subject: C=US; ST=California; O=Apple Inc.; CN=weather-data.apple.com start date: Oct 9 21:14:44 2024 GMT expire date: Jan 7 20:21:03 2025 GMT subjectAltName: host "weatherkit.apple.com" matched cert's "weatherkit.apple.com" issuer: C=US; O=Apple Inc.; CN=Apple Public Server ECC CA 1 - G1 SSL certificate verify ok. using HTTP/1.x GET /api/v1/availability/37.323/122.032?country=US HTTP/1.1 Host: weatherkit.apple.com User-Agent: curl/8.7.1 Accept: / Authorization: Bearer [token] Request completely sent off &lt; HTTP/1.1 401 Unauthorized &lt; Server: Apple &lt; Content-Type: application/json &lt; Content-Length: 26 &lt; X-Frame-Options: SAMEORIGIN &lt; Strict-Transport-Security: max-age=31536000; includeSubdomains &lt; X-XSS-Protection: 1; mode=block &lt; Access-Control-Allow-Origin: * &lt; X-Content-Type-Options: nosniff &lt; Content-Security-Policy: default-src 'self'; &lt; X-REQUEST-ID: 320cab08-acba-0127-fe19-4893dacf059c &lt; X-Apple-Origin: 3c6511d9-6be2-32cb-8412-efd1b1efa576 &lt; Content-Disposition: inline;filename=f.txt &lt; Date: Tue, 15 Oct 2024 10:40:01 GMT &lt; X-Cache: TCP_MISS from a23-220-165-87.deploy.akamaitechnologies.com (AkamaiGHost/11.6.5-30d892fcde524eb1bee7eeb45111707d) (-) &lt; Connection: keep-alive &lt; Connection #0 to host weatherkit.apple.com left intact {"reason": "MISSING_AUTH"}
0
0
168
3d
Weather App
I keep getting severe weather warnings in CA but I’m in NY. I have checked my locations and I have no CA weather requests selected. I clicked on the alert and it said it was from weatherkit. How do I make these CA go away for good? Thanks!
3
0
245
Oct ’24
Did WeatherKit minutely precipitation intentionally change units?
I've noticed in the past few weeks that the minutely precipitation values reported by WeatherKit are much bigger than they were before. Specifically I'm referring to WeatherKit.MinuteWeather.precipitationIntensity. In my app, I convert to mm per hour: let mmPerHour = $0.precipitationIntensity.converted(to: UnitSpeed.kilometersPerHour).value * 1e6 This has worked perfectly since WeatherKit came out, but now when I look at rainy locations and compare with the built-in Apple Weather app on my phone, it seems that the new values are about 3x what they should be. I have checked this in multiple locations across the USA. My intuition says this is an inches/cm conversion issue (2.54x). Is this an intentional change in WeatherKit that requires me to update my app, or is this a bug on Apple's end??
2
0
350
Aug ’24
Mismatch between DayWeather date and HourWeather date
A year ago I filed feedback FB13055082 about this and I just realized that it was marked as "works as currently designed". I need help understanding why this is the expected behavior. For the feedback example I used Nepal, which is +5:45 from GMT. When the UTC offset is not at an hour interval, the dates returned by DayWeather and HourWeather do not match. I’ll request weather with a start date of Aug 25 at 12:0:0 AM GMT+5:45 and end date of Sep 3 at 12:0:0 AM GMT+5:45. The first daily forecast returns a date of Aug 25, 2023 at 12:0:0 AM GMT+5:45, which is what I expect. It's midnight in Nepal and the start of the day. If in my code I call (correct calendar).startOfDay(for: ) I'll also get this same time back. However, the first hourly forecast returned is for Aug 25, 2023 at 12:45:0 AM GMT+5:45 which is NOT the start of the day in Nepal or the start I asked for. It is 45 minutes off. How is the hourly data not starting at the time I requested the expected behavior? Especially when the day data does start at the time I requested.
1
0
335
Aug ’24
WeatherKit :: DailyForecast :: Sunrise :: ForEach :: Timezone Issue
My application engages the following: Generates and properly displays a selected location with MapKit. Generates SwiftUI WeatherKit information for a selected MapKit location. Generates correct Timezone WeatherKit [DayWeather] Sunrise and Sunset times within my timezone using the [ForEach] function. Generates incorrect Timezone WeatherKit [DayWeather] using the ForEach function, while retrieving Sunrise and Sunset times outside of my timezone. I modified my MapKit application to locate and retrieve weather information at specified locations. The application correctly illustrates all the weather information views I want to display without issue for a MapKit selected location. One view exception presents itself specific to the [ForEach] function inside a WeatherKit view, which retrieves Sunrise and Sunset information. The retrieved Sunrise and Sunset times for a selected timezone location outside of my identified timezone are not correct. My application does not generate nor apply an incorrect timezone identifier, such as [Europe/Paris] anywhere within the application, but the following view code segment surely hiccups. The selected timezone location view presents the Sunrise and Sunset time information as an equivalent time within my timezone, displayed in the images below. The issue happens to be within the view's following ForEach function code: Text(day.sun.sunrise?.formatted(.dateTime.hour().minute()) ?? "?") For the moment, I am struggling to discover how to correct the above code to properly display the [Sunrise] and [Sunset] times within a [ForEach] function. I do not know whether this issue happens to be inherent to WeatherKit's ForEach function, but most likely I am not properly applying the code to reflect the selected location's timezone format within the [Text]. I have not found a solution to apply within the [ForEach] function to correct this issue, as the application iterates through the supplied WeatherKit DayWeather information. I know I can retrieve the correct current TimeZone time for a selected location with the following code: func main() { let d = Date() // Show the [VARIABLE f] as [HOUR / MINUTE] such as [12:23PM] var f = Date.FormatStyle.dateTime.hour().minute() print("The [LOCAL TIME ZONE TIME with MAIN] :: \(d.formatted(f))") f.timeZone = TimeZone(identifier: "Europe/Paris")! print("The [SELECTED TIME ZONE TIME with MAIN] :: \(d.formatted(f))\n") } // Call the function main() The above code does not solve my application's issue, because the code simply returns the selected location's current timezone time relative to my current timezone time. So, if my timezone time happens to be 1:40 PM, then the above code generates a timezone time for a selected location, such as Paris to be 9:40 PM. I know a [View] does not respond to the incremental function code, such as stated above. As a side note :: My application displays the WeatherKit information through a Container and Hosting Controller, where the application's SwiftUI ContentView calls :: if let dailyForecast { TestForecastView(dailyForecast: dailyForecast, timezone: timezone) } If you have a moment, I appreciate your possible corrective suggestions, which would be very welcome ... :] Best regards, jim_k My TestForecastView Code with the attached generated views follow: import Foundation import SwiftUI import CoreLocation import WeatherKit struct TestForecastView: View { let dailyForecast: Forecast&lt;DayWeather&gt; let timezone: TimeZone var body: some View { Spacer() .frame(height: 10) Text("Sunrise Sunset") .font(.system(size: 24, weight: .bold)) .foregroundStyle(.white) Text("Ten Day Forecast") .font(.system(size: 11, weight: .medium)) .foregroundStyle(.white) Spacer() .frame(height: 4) VStack { ForEach(dailyForecast, id: \.date) { day in LabeledContent { HStack(spacing: 20) { RoundedRectangle(cornerRadius: 10) .fill(Color.orange.opacity(0.5)) .frame(width: 120, height: 5) .padding(.leading, 2) .padding(.trailing, 0) VStack { Image(systemName: "sunrise") .font(.system(size: 24.0, weight: .bold)) .foregroundColor(.yellow) Text(day.sun.sunrise?.formatted(.dateTime.hour().minute()) ?? "?") .font(.system(size: 10.0)) } .frame(width: 50, height: 20) VStack { Image(systemName: "sunset") .font(.system(size: 24.0, weight: .bold)) .foregroundColor(.yellow) Text(day.sun.sunset?.formatted(.dateTime.hour().minute()) ?? "?") .font(.system(size: 10.0)) } .frame(width: 50, height: 20) Spacer() .frame(width: 2) } } label: { Text(day.date.localDate(for: timezone)) .frame(width: 80, alignment: .leading) .padding(.leading, 30) .padding(.trailing, 0) } .frame(width: 380, height: 52) .background(RoundedRectangle(cornerRadius: 4).fill(LinearGradient(gradient: Gradient(colors: [Color(.systemBlue), Color(.black)]), startPoint: .topLeading, endPoint: .bottomTrailing)).stroke(.black, lineWidth: 6).multilineTextAlignment(.center)) .shadow(color: Color.white.opacity(0.1), radius: 4, x: -2, y: -2) .shadow(color: Color.white.opacity(0.1), radius: 4, x: 2, y: 2) } } .padding(.top, 20) .padding(.bottom, 20) .padding(.leading, 20) .padding(.trailing, 20) .contentMargins(.all, 4, for: .scrollContent) .background(RoundedRectangle(cornerRadius: 10).fill(Color.black.opacity(0.0)).stroke(.gray, lineWidth: 4)) } // End of [var body: some View] } // End of [struct TestForecastView: View] My resultant code views :: Calgary Paris
4
0
499
Aug ’24
Location requested in WeatherService monthlyStatistics() does NOT match the location in the response
We pass a CLLocation to the new WeatherService monthlyStatistics() BUT in the returned metadata the CLLocation data does NOT match what we sent in the request. For example, send lat -27.1480114 long -109.4273371 in the monthly stat request and get back data for lat -27.148000717163086, long -109.427001953125. There’s no mention in the documentation of the returned location being “close to” the requested location. If this is working as designed how close are the results allowed to be? In my small sample they seem to be around 45-55 meters away. I’m considering less than 100 meters away to be a match, but don’t know if that’s correct.
1
0
358
Jul ’24
Open iOS Weather App
I am using WeatherKit to display relevant weather information to the User in my App. I also thought it would be helpful to show any time-sensitive WeatherAlert. I would like to direct the User directly into the system Weather app to get more details/information. weather://open ... works... Is this a faux-pas? Is there a approved/proper way of doing this? I know WeatherAlert.detailsURL exists but I figured it may be useful for the User to see all details related to weather right from the source.
0
0
376
Jul ’24
Enhance Weather app with Celsius/Fahrenheit conversion options and dual display
I would like to request two enhancements to the Weather app: Add a Celsius/Fahrenheit conversion option directly on the home page, rather than requiring users to access it through the three-dot menu. Consider displaying both Celsius and Fahrenheit scales side by side, without requiring users to choose a conversion option(only if its feasible for your team). This would be particularly helpful for users who are familiar with both scales, such as Asians living in America. Thank you for considering my request!
1
0
369
Jul ’24