Post not yet marked as solved
Hey all, so, my app was rejected because "We noticed your app displays Apple weather data but does not include the required Apple Weather attribution."
My app pulls current, hourly, and daily weather conditions. It doesn't pull alerts.
I display the apple logo and attribution link on my Credits page in the Settings -> About page. (As well as showing the logo on the Launch Screen and mentioning it in the App Store description). I basically subbed out 'DarkSky' for 'WeatherKit'. But apparently this isn't enough?
The "Get Started" page for WeatherKit says "you must clearly display the Apple Weather trademark (Weather), as well as the legal link to other data sources." This doesn't make it clear where the "clearly display" needs to happen. Are we supposed to put an apple logo on every screen that shows any weather details?
Any help/advice would be appreciated.
Post not yet marked as solved
Hi there! Please could you publish some of the specifics for authentication for the new WeatherKit REST API? I am attempting to use something cobbled together from MapKit, and unfortunately WeatherKit returns a 500 error in response.
Broken code sample below. If you find a working solution or can identify an error, please comment with the solution. Thank you!
require 'http'
require 'jwt'
require 'openssl'
require 'logger'
p8 = OpenSSL::PKey::EC.new(File.read("/PATH/TO/DOWNLOADED/P8/FILE"))
token = JWT.encode({
iss: 'KEY_NAME_FROM_CIP',
iat: Time.now.to_i,
exp: Time.now.to_i + 3600,
aud: 'weatherkit',
}, p8, 'ES256', {
kid: 'KEY_ID_FROM_CIP',
typ: 'JWT'
})
res = HTTP.use(logging: {
logger: Logger.new(STDOUT)
}).headers(
"Authorization" => "Bearer #{token}"
).get "https://weatherkit.apple.com/api/v1/weather/en/LONG/LAT?dataSets=currentWeather&timezone=Europe/London"
puts "code: #{res.code}"
puts res.body
Post not yet marked as solved
My SwiftUI weather app shows weather stats for the day that I'm pulling from DayWeather. I added wind speed to my app recently. I wanted to add Gusts but I hit a problem. Whenever I look at the results returned for DayWeather the "gust" inside of Wind is always nil.
The iOS weather app includes gusts in a daily summary. For example, today for ****** River, OR it says "Wind is currently 15 mph from the southeast. Today, wind speeds are 8 to 26 mph, with gusts up to 50 mph."
A query I just did to WeatherKit returned 18mph with compass direction SSE but nil for gusts.
I've searched the documentation and I can't determine if this is working as designed or a bug.
Post not yet marked as solved
Specifically,
In (https://developer.apple.com/account/resources/identifiers/):
I can't find the Weatherkit option under Capabilities or App Services in the configuration of the identifier.
In Xcode:
Add WeatherKit capability fail. output log:
The capability associated with "WEATHERKIT" could not be determined. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator.
Is it related to my region and account?
My account is Apple Developer Enterprise Program , the region is Mainland China.
Post not yet marked as solved
I am migrrating my app from darksky api to weatherkit api, so I need supscription with 50M calls/month. But now I only can subscribe the package with 5M calls. Other packages which over 5M calls ex 10M calls, 20M calls, 50M calls, 100M calls always get unsuccessful when I tried to subscribe. Please help me or give me some advices.
Post not yet marked as solved
After Apple essentially shut down Dark Sky early (you can't trust it if it's off-line 8 hours a day 2/3 days), I've transitioned production traffic to WeatherKit.
Generally slower (higher p50's, significantly higher p90s)
Under bursts of traffic, it just chokes. Always. I have many users who have things set up to retrieve the weather on the hour (e.g., 6:00am). I have to have a failover weather source for these peaks, because weather kits just stops returning data under heavy load.
It's not really acceptable that I'm paying significant $$$ for an API, and have to have another source for when the API predictably chokes.
Dark Sky handled the load without breaking a sweat. Ever.
I'm not sure what to do here. It's not an issue with the code, so there's no point in opening a code level support ticket. The feedback assistant refers you to the forums. General performance issues are not addressed by Apple engineers on the forums.
So, the whole thing is a bit Kafkaesque.
Is stumbling under load expected behavior?
Does Apple have any performance expectations for the API?
I've never dealt with an API provider that you couldn't get some sort of acknowledgement about issues. It's just weird.
Post not yet marked as solved
Earlier today, DarkSky API stopped responding and is still not responding to our requests.
It returns an HTTP 503 Service Temporarily Unavailable error.
Post not yet marked as solved
Hi all,
We recently completed the transition from Darksky to Weatherkit and have started receiving "inaccurate weather" complaints. We have successfully recreated the problem and believe the cause is stale data being returned.
Weather Kit returns a reportedTime (The time the provider reported the weather data.) in the metadata of each dataset. We are seeing that the value of reportedTime is often up to 2+ hours old. This doesn't matter so much for forecasted data but for currentWeather, forecastNextHour and weatherAlerts its very important to have relatively recent weather data.
Users are expecting to know what the current weather is outside but are receiving information that is 2hrs old. When its raining or snowing outside and we are reporting clear in some cases.
Questions.
Are we doing something wrong or is this by design? This is how we are requesting 👇🏽
https://weatherkit.apple.com/api/v1/weather/en_US/25.76/-80.19?dataSets=currentWeather,forecastHourly,forecastDaily,weatherAlerts&country=US&timezone=America/New_York
When I look at the Apple Weather app the weather appears to be up to date. Is the behavior different for swift? I assume the Apple Weather app is using swift and Weather Kit.
Thanks
I am looking into the possibility of adding WeatherKit support to one of my apps. I have added the WeatherKit capability to my app and can see it up in the App ID configuration, the bundle ID is marked as explicit.
I waited overnight just in case, but I keep just getting the following error when I run on a real device:
Error Domain=WeatherDaemon.WDSJWTAuthenticatorService.Errors Code=1 "(null)"
This app has been in the store for years, so I know the rest of the configuration should be fine. What am I missing?
Post not yet marked as solved
If I had historical data back to 2017, the WeatherKit REST API data would be great for training data science forecasting models. The information is there in DarkSky, but it is not accepting new users and I can't access it, and the WeatherKit API only goes back to 8/1/21. Making historical data available would be a great way to advance the field of data science and climate research.
Post not yet marked as solved
I'm trying to write a program in python 2.7 to get data via WeatherKit using an HTTP request. Following the documentation in Request auththentication for WeatherKit REST API, I went to jwt.io to create the token. The documentation says to "sign it with your WeatherKit private key using the ES256 algorithm". I have my WeatherKit private key, but the ES256 algorithm seems to also require a public key to sign the token. How do I get a valid public key to match my private key, or is there a legitimate way to bypass that requirement?
Also, I've seen posts that seem to say that tokens expire within hours of being created. I want to create a token that expires a long time out (perhaps in a year), and just hard code that into my program.
I can't fetch the weather using the WeatherKit framework inside a Widget Extension.
Here's a project I created just for this example. This widget shows the humidity of a sample location.
Here's the code:
import WidgetKit
import SwiftUI
import WeatherKit
import CoreLocation
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), humidity: 9.99) // placeholder humidity
}
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), humidity: 9.99) // placeholder humidity
completion(entry)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
Task {
let nextUpdate = Date().addingTimeInterval(3600) // 1 hour in seconds
let sampleLocation = CLLocation(latitude: 51.5072, longitude: 0.1276) // sample location (London)
let weather = try await WeatherService.shared.weather(for: sampleLocation)
let entry = SimpleEntry(date: .now, humidity: weather.currentWeather.humidity)
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
completion(timeline)
}
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let humidity: Double
}
struct WidgetWeatherTestWidgetEntryView : View {
var entry: Provider.Entry
var body: some View {
Text("\(entry.humidity)")
}
}
struct WidgetWeatherTestWidget: Widget {
let kind: String = "WidgetWeatherTest"
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: Provider()) { entry in
WidgetWeatherTestWidgetEntryView(entry: entry)
}
.configurationDisplayName("Widget Weather Test")
.description("Testing weatherkit in a Widget")
.supportedFamilies([.systemMedium])
}
}
It works fine in the simulator:
But it doesn't work in a real device. As soon as I call WeatherService's weather(for: CLLocation) async throws -> Weather the widget get's "blocked":
I've tried moving the try await WeatherService.shared.weather(for: sampleLocation) to different places, but nothing worked. As soon as I comment out this line (and create an entry with a placeholder humidity) everything works.
I added the WeatherKit capability in the main app target and in the WidgetExtension target. I also added the WeatherKit "Capability" and "App Service" in the "Certificates, Identifiers & Profiles" of the Apple Developer website.
The WeatherKit framework works fine in other parts of the main app.
I haven't tried using the WeatherKit REST API, yet.
Any ideas what could be happening?
Post not yet marked as solved
I have recently been getting 401 authorization failed from weatherkit in swift. I have an app in production that had always worked well with weatherkit but recently it has been failing. It has worked well for months and with no changes started to fail. Getting attribution works fine but im assuming that does not require any authorization.
what I have done:
Checked that both weatherkit capabilities are checked in the app’s identifier on my apple developer account
double checked that my developer account is active
created a fresh identifer with proper capabilities and waited an hour then tried to get data from weatherkit. Still failed.
Is anyone coming across the same issue? Or maybe it’s possible that my developer account is not authorized for weatherkit for some reason? I’m really at a loss here on why it’s failing.
Post not yet marked as solved
When using Apple weatherkit getting {'reason': 'NOT_ENABLED'} error tried getting new keys and service id's
Post not yet marked as solved
Is there a way to verify my JWT Token? I have some python code that uses the pypi.org jwt module, and would like to verify that the token coming out of it is correct.
I am getting {"reason": "NOT_ENABLED"} and I would like to make sure that my token is constructed correctly.
I have seen a few others that have the "aud": entry in the header, but it's not mentioned in the documentation.
Further confusion over this documentation is the statement to use the "ES256" algorithm, but that requires .pem and a .pub files, but only a .p8 is supplied. (note I can extrapolate .pem and .pub files from the .p8, but that is not even discussed.
Can anyone from Apple chime in?
Post not yet marked as solved
If you haven't yet, submit your feedback to https://feedbackassistant.apple.com/new-form-response
I found WeatherKit under iOS & iPadOS (scroll all the way down).
Recent Similar Reports show as "None", so perhaps there hasn't been enough reports.
Also, it's ridiculous Apple hasn't responded to any of the recent posts in this forum. 15 days left of support for Dark Sky and WeatherKit has been down for almost 2 days without any acknowledgement from Apple.
Post not yet marked as solved
Another day, another slew of issues with WeatherKit.
It's not ready.
Apple: you said you'd have a replacement for Dark Sky available. People made plans around this.
Do the right thing and keep Dark Sky API available until you're able to sort through the issues with WeatherKit.
Post not yet marked as solved
I created an identifier, but did not select "Sign In with Apple"
I created a key, and enabled the WeatherKit service.
I have a simple python script to retrieve from the API, but I am getting "NOT ENABLED"
import datetime
import time
# pip install requests PyJWT cryptography
import jwt
import requests
import json
from cryptography.hazmat.primitives.serialization import load_ssh_private_key
from hashlib import sha1
with open("/Users/don/.ssh/AuthKey_LBV5W26ZRJ.p8", "r") as f:
myKey = f.read()
# matches my service id
WEATHERKIT_SERVICE_ID = "net.ag6hq.sandysclock"
#This is my id, redacted here
WEATHERKIT_TEAM_ID = "<redacted>"
# this is my private key, redacted here
WEATHERKIT_KID = "<redacted>" # key ID
WEATHERKIT_KEY = myKey
WEATHERKIT_FULL_ID = f"{WEATHERKIT_TEAM_ID}.{WEATHERKIT_SERVICE_ID}"
thisLat = 34.03139251897727
thisLon = -117.41704704143667
def fetch_weatherkit(
lang="en",
lat="34.031392",
lon="-117.41704",
country="US",
timezone="US/Los_Angeles",
datasets = "currentWeather,forecastDaily,forecastHourly,forecastNextHour",
):
url = f"https://weatherkit.apple.com/api/v1/weather/{lang}/{lat}/{lon}?dataSets={datasets}&countryCode={country}&timezone={timezone}"
now = int(time.time())
exp = now + (3600 * 24)
token_payload = {
"sub": WEATHERKIT_SERVICE_ID,
"iss": WEATHERKIT_TEAM_ID,
"exp": exp,
"iat": now
}
token_header = {
"kid": WEATHERKIT_KID,
"id": WEATHERKIT_FULL_ID,
"alg": "ES256",
"typ": "JWT"
}
token = jwt.encode(token_payload, WEATHERKIT_KEY, headers=token_header, algorithm="ES256")
response = requests.get(url, headers={'Authorization': f'Bearer {token}'})
return response
####
End of Def
myFetch=fetch_weatherkit()
myStatus=myFetch.status_code
myJSON=myFetch.json()
print("myJSON=" + str(myJSON))
print("myStatus=" + str(myStatus))
This outputs:
python weatherkit.py
myJSON={'reason': 'NOT_ENABLED'}
myStatus=401
I get the same results if I use the jwt.io service to create a token and use curl
What am I doing wrong?
Post not yet marked as solved
Trying to transition over to weatherkit for production traffic. However, the pattern is clear: as the load increases, the frequency of slow responses ( > 650ms) and 502 Bad Gateway errors increases. In peak conditions, more than 50% of requests fail.
Apple says the API is not rate limited. So just wondering if others have experienced this and found a solution.
Post not yet marked as solved
When using Apple weatherkit getting {'reason': 'NOT_ENABLED'} error tried getting new keys and service id's