comyar / czweatherkit Goto Github PK
View Code? Open in Web Editor NEW:partly_sunny: A Simple Cocoa Weather Library.
Home Page: https://comyar.io/projects
License: BSD 2-Clause "Simplified" License
:partly_sunny: A Simple Cocoa Weather Library.
Home Page: https://comyar.io/projects
License: BSD 2-Clause "Simplified" License
Greetings ... the title says it all. Am I missing an easy way to accomplish this?
Thanks!
CZWeatherCondition
overrides description, a property originally declared in NSObject
.
Unfortunately, NSObject
declares description to be readonly.
This didn't seem to be a problem in previous versions of Xcode, but as of 6.0 it will cause the following warning:
Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it will be synthesized 'readonly' via another property.
As a result, [CZWeatherCondition setDescription:]
will not be synthesized, and assignment of the description property will fail.
You might want to rename the property to conditionDescription or something and to keep some backwards compatibility, you might do:
- (NSString *)description {
return self.conditionDescription;
}
Hello. It's me again.
Well... Something is wrong with 2.2.3. It doesn't complete the weather request.
Have no idea what is going on. Btw, I can show you my code.
I'm going to work with 2.2.1 because it works fine. Need any help with debuggin? Just tell my how to help
CZOpenWeatherMapRequest *request = [CZOpenWeatherMapRequest newCurrentRequest];
request.location = [CZWeatherLocation locationFromCoordinate:CLLocationCoordinate2DMake(52.9661803, 87.9315624)];
request.key = @"SOME KEY. DON'T WANT TO SHOW MINE";
[request sendWithCompletion:^(CZWeatherData *data, NSError *error) {
if (error == nil)
{
NSMutableDictionary *weather = [NSMutableDictionary new];
[weather addEntriesFromDictionary:@{@"temperature":[NSNumber numberWithFloat:data.current.temperature.c]}];
[weather addEntriesFromDictionary:@{@"humidity":[NSNumber numberWithFloat:data.current.humidity]}];
[weather addEntriesFromDictionary:@{@"windspeed":[NSNumber numberWithFloat:data.current.windSpeed.kph / 3.6f]}];
[weather addEntriesFromDictionary:@{@"climacon":[NSNumber numberWithInt:data.current.climacon]}];
[weather addEntriesFromDictionary:@{@"date":[NSDate date]}];
[[VKManager instance] setWeather:weather];
[[NSUserDefaults standardUserDefaults] setObject:weather forKey:@"gesh.weather"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
else
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[[VKManager instance] requestWeather];
});
}
}];
When I'm trying to get the forecast, the return value is empty.
This is the code:
CZWeatherRequest *request = [CZWeatherRequest requestWithType:CZForecastRequestType];
request.location = [CZWeatherLocation locationWithCity: country:];
request.service = [CZWundergroundService serviceWithKey:];
request.detailLevel = CZWeatherRequestFullDetail;
[request performRequestWithHandler:^(id data, NSError *error) {
if (data) {
forecasts = (NSArray *)data;
NSLog(@"%@", data);
}
else
NSLog(@"%@", error);
}];
I was getting only 4 days of forecast no matter what i typed inside this method: CZOpenWeatherMapRequest.newDailyForecastRequestForDays(7)
I noticed in CZWeatherRequest class // dispatchWithAPI method the [self copy] only retains feature string.
The OpenWeatherMap API returns those values in the "main" node (not the root, the "main" actually).
I don't know if other providers dispatch those information as well, but could be useful to support them in the CZWeatherCurrentCondition class
Would love to see CZWeatherKit support querying historical weather data (cf http://openweathermap.org/history). I may add this for my own purposes if it is not already planned…
How do i get the chance of rain?
Hi,
why the windspeed is not available in the Forecast any longer?
Sascha
We got a crash in
-[CZOpenWeatherMapService parseCurrentConditionsFromJSON:](in MyWeatherCenter) (CZOpenWeatherMapService.m:146)
What is the best way to handle this? Is it enough to check JSON for Null value in parseCurrentConditionsFromJSON?
Thanks
Sascha
I tried following the example on the cocoapods page as well as general advice on custom fonts and iOS etc, but no dice. It just shows the char mapped to the climacon, not the actual icon. See http://stackoverflow.com/questions/37199314/getting-climacons-to-display-in-uilabel-with-czweatherkit-in-swift
Hi,
may be you have an idea...
I want to add WatchKit support to my app. But when I integrate CZWeatherKit and compile I get the the following errors:
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_CZOpenWeatherMapService", referenced from:
objc-class-ref in SensorViewController.o
"OBJC_CLASS$_CZWeatherLocation", referenced from:
objc-class-ref in SensorViewController.o
"OBJC_CLASS$_CZWeatherRequest", referenced from:
objc-class-ref in SensorViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks
Sascha
Hi,
why high and low temp and station ID are missing now in current weather information?
Thanks
Sascha
Can you add tvos support to the podspec so tvos apps can use it?
You should add support for system metrics and localization (at least for Open Weather API) when constructing the URL.
Thx.
When archiving a CZWeatherCurrentCondition, CZWeatherForecastCondition, CZWeatherHourlyCondition or CZWeatherLocation object the application crash. The crash is due to a bug when archiving structs.
Execution of:
[NSKeyedArchiver archiveRootObject:weatherData toFile:[NSTemporaryDirectory() stringByAppendingString:@"archive"]];
Result in the following exception:
Assertions: failed: caught "NSInvalidArgumentException", "*** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs"
(
0 CoreFoundation 0x000000010cc1df45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c697deb objc_exception_throw + 48
2 CoreFoundation 0x000000010cc1de7d +[NSException raise:format:] + 205
3 Foundation 0x000000010c302a32 -[NSKeyedArchiver encodeValueOfObjCType:at:] + 311
4 Foundation 0x000000010c329b4a -[NSValue encodeWithCoder:] + 317
5 Foundation 0x000000010c328f22 -[NSConcreteValue encodeWithCoder:] + 297
6 Foundation 0x000000010c2916c7 _encodeObject + 1259
7 CZWeatherKit 0x00000001167380e8 -[CZWeatherLocation encodeWithCoder:] + 284
8 Foundation 0x000000010c2916c7 _encodeObject + 1259
9 Foundation 0x000000010c2cc442 +[NSKeyedArchiver archiveRootObject:toFile:] + 241
...
)
The part the cause this crash is:
NSValue *coordinateValue = [NSValue value:&_coordinate
withObjCType:@encode(CLLocationCoordinate2D)];
[aCoder encodeObject:coordinateValue forKey:@"coordinate"];
It's correct to do this, but it's seams to be a knowing bug (rdar://8631663).
An existing workaround is to archive/unarchive the values of the struct manually.
Something like this:
NSNumber *latitude = [NSNumber numberWithDouble:self.coordinate.latitude];
NSNumber *longitude = [NSNumber numberWithDouble:self.coordinate.longitude];
[aCoder encodeObject:latitude forKey:@"latitude"];
[aCoder encodeObject:longitude forKey:@"longitude"];
The problem is exactly the same with the structs CZHumidity, CZTemperature and CZWindDirection.
I'm going to fix it on my side, and create a PR.
Also if you know any better solution, said it!
When using CZopenWeatherMapRequest with LocationFromCoordinate the API URL is incorrectly formatted
http://api.openweathermap.org/data/2.5/weather?lat=51.2758,lon=-0.7763&lang=en&mode=json&APPID=XXXXX
The lat and lon should be separated by an & not a ,
I think the problem is componentForLocation in CZopenWeatherMapAPI
Hi,
shouldn't
CZOpenWeatherMap *request = [CZOpenWeatherMap newCurrentRequest];
request.location = [CZWeatherLocation locationForCity:@"Seattle" state:@"WA"];
[request sendWithCompletion:^(CZWeatherData *data, NSError *error) {
CZWeatherCurrentCondition *condition = date.current;
// dreams come true here
}];
look like this?
CZOpenWeatherMapRequest *request = [CZOpenWeatherMapRequest newCurrentRequest];
request.location = [CZWeatherLocation locationForCity:@"Seattle" state:@"WA"];
[request sendWithCompletion:^(CZWeatherData *data, NSError *error) {
CZWeatherCurrentCondition *condition = date.current;
// dreams come true here
}];
and "date.current", should be "data.current" I guess..
Sascha
Duplicate case value: 'ClimaconFahrenheit' and 'ClimaconShowers' both equal '39'
ClimaconFahrenheit = ''',
ClimaconShowers = ''',
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.