Code Monkey home page Code Monkey logo

googlekit's Issues

textsearch

Вызывающий код:

- (void)buttonSearchPressed:(id)sender
{
    [self dismissKeyboard];

    NSLog(@"<%@>", _searchBar.text);

    GKPlacesQuery *query = [GKPlacesQuery query];
    query.key = @"keykeykey";
    query.language = @"en";
    query.text = _searchBar.text;

    [query textSearch:^(NSArray *results, NSString *nextPageToken, NSError *error)
    {
        if (results)
            NSLog(@"Search OK");
    }];
}

Ожидаемый URL запроса:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=london&language=en&sensor=false&key=keykeykey

Фактический URL запроса:

https://maps.googleapis.com/maps/api/place/textsearch/json?key=keykeykey&query=(null)&location=0.000000,0.000000&rankby=prominence&radius=1000&language=en

Обратите внимание на (null) - куда-то потерялся сам текст запроса ("london"). Кроме того, отсутствие параметра, например, location вовсе не равно присутствию этого параметра с нулевыми координатами - нулевые координаты так же, как и любые другие, обозначают место на земной поверхности, поэтому неясно, на каком основании вы добавляете этот и другие параметры с какими-то дефолтными значениями. Эти параметры опциональны в API, зачем вы их добавляете принудительно?

Location property

Максим, в некоторых запросах присутствует проперти location - например, здесь:

GKGeocoderQuery *query = [GKGeocoderQuery query];
// required parameters
query.key = @"key";
query.location = CLLocationCoordinate2DMake(0.0f, 0.0f);

Это, конечно, непринципиально, но немного сбивает с толку - дело в том, что есть две сущности с координатами - CLLocation и CLLocationCoordinate2D - и обычно стараются делать так, чтобы имя проперти соответствовало типу сущности. Т.е. если я вижу query.location, то я буду почти уверен, что это CLLocation, и буду сильно удивлен, когда окажется, что это не так. Мелочь, конечно, но если вы измените имя, скажем, на query.coordinate, многие спасибо скажут. :)

Reverse Geocoding (Address Lookup) doesn't work

Максим, вот этот запрос не работает:

GKGeocoderQuery *query = [GKGeocoderQuery query];
    query.coordinate = _myLocation.coordinate;
    query.language = @"en";

    [query lookupAddress:^(NSArray *results, NSError *error)
     {
         if (error)
             return;

         GKGeocoderPlace *place = [results firstObject];
         _myLocationAddress = place.formattedAddress;
     }];

Возвращается пустой result, хотя ошибок нет. В отладчике видно, что происходит обращение к суперклассу (GKQuery), в котором соответствующий метод-шаблон возвращает nil.

Connection Problem

I was using this lib, worked ok, but suddenly stopped bringing data... for any search term

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.