Giter VIP home page Giter VIP logo

Comments (7)

comyar avatar comyar commented on August 17, 2024

Could you provide some information on how to recreate this? What city/coordinate/etc are you getting data for? Are you using an API key? A small code sample would help diagnose this.

I believe I know what the issue is, so I'll go ahead and mark this as a bug.

from czweatherkit.

souhl avatar souhl commented on August 17, 2024

Yes, I am using an API Key. And this doesn't happen always. It just happened a few times now.

CZWeatherRequest *request = [CZWeatherRequest requestWithType:CZCurrentConditionsRequestType];
request.location = [CZWeatherLocation locationWithCLLocationCoordinate2D:place.coordinate ];
request.service = [CZOpenWeatherMapService serviceWithKey:@"XXXXXXXXX"];
LogDebug(@"WEATHERREQUEST STARTED");

if (timeOut == NULL) {

    timeOut = [NSTimer scheduledTimerWithTimeInterval: 3
                                               target: self
                                             selector: @selector(cancelURLConnection:)
                                             userInfo: nil
                                              repeats: NO];
    //[timeOut retain];
}

[request performRequestWithHandler:^(id data, NSError *error) {
    if (data) {
        [timeOut invalidate];
        LogDebug(@"WEATHERREQUEST DATA RETRIEVED");

from czweatherkit.

comyar avatar comyar commented on August 17, 2024

What's the value of place.coordinate when it fails?

I'm guessing OpenWeatherMap's response contains "main": null in its response even when it doesn't have data for the given coordinate. If you see line 145 in OpenWeatherMapService.m then it makes sense why this is failing; JSON[@"main"] is returning NSNull and then we're trying to use the NSNull as a dictionary. I'll read up on their API to make sure this is what's happening.

from czweatherkit.

souhl avatar souhl commented on August 17, 2024

I added a check with CLLocationCoordinate2DIsValid and will test again.

from czweatherkit.

comyar avatar comyar commented on August 17, 2024

I'm currently working on an update to fix this issue. Just wanted to let you know.

from czweatherkit.

souhl avatar souhl commented on August 17, 2024

Great! Thanks

from czweatherkit.

comyar avatar comyar commented on August 17, 2024

Alright, I think this is resolved in the new release. I'll go ahead and close this issue, but please open it again if you find any issues. Thanks.

from czweatherkit.

Related Issues (20)

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.