Giter Site home page Giter Site logo

comyar / czweatherkit Goto Github PK

View Code? Open in Web Editor NEW
450.0 450.0 64.0 2.73 MB

:partly_sunny: A Simple Cocoa Weather Library.

Home Page: https://comyar.io/projects

License: BSD 2-Clause "Simplified" License

Objective-C 96.90% Ruby 0.50% C 0.98% Swift 1.62%

czweatherkit's People

Contributors

awph avatar cerupcat avatar comyar avatar readmecritic avatar sebj avatar tobiaghiraldini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

czweatherkit's Issues

CZWeatherCondition.description interferes with NSObject.description

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.

screen shot 2014-09-06 at 4 22 17

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;
}

2.2.3 doesn't work (same code works on 2.2.1)

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];
        });
    }
}];

CZForecastRequestType doesn't return data

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);
}];

Add minTemp and maxTemp to CurrentWeatherCondition

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

Problem with WatchKit integration

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

ClimaconCharacter change with Language

Hi,

The ClimaconCharacter isn't the same when you change the language for the same city.
For example:
When I set the language to english, the ClimaconCharacter is '$'. But in French for the same city and the same time, the ClimaconCharacter is 'I'. But the summary is translate well.
bug

Best regards

localization

You should add support for system metrics and localization (at least for Open Weather API) when constructing the URL.
Thx.

Crash when archiving CZWeatherCurrentCondition, CZWeatherForecastCondition, CZWeatherHourlyCondition & CZWeatherLocation

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!

Shouldn't it be CZOpenWeatherMapRequest in your example

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.