Search code examples
iosobjective-csearchskmaps

SKmaps failed to perform multi level search


I want to make a multi level offline search in my app. I followed the directions at official Skobbler page and only difference is that l did not download map of France, but map of Wyoming instead.

Offline package code for it is USWY if I am right.

-(void)prepareForSearch{
[SKSearchService sharedInstance].searchServiceDelegate = self;
[SKSearchService sharedInstance].searchResultsNumber = 500;
_listLevel = SKCountryList;

_searchSettings = [SKMultiStepSearchSettings multiStepSearchSettings];
_searchSettings.listLevel = _listLevel;
_searchSettings.offlinePackageCode = @"USWY";
_searchSettings.parentIndex=-1;
}


- (IBAction)searchAction:(UIButton *)sender {

_searchSettings.searchTerm = [NSString stringWithFormat:@"%@",_searchBar.text];
[[SKSearchService sharedInstance]startMultiStepSearchWithSettings:_searchSettings];

}

-(void)searchService:(SKSearchService *)searchService didRetrieveMultiStepSearchResults:(NSArray *)searchResults
{
if ([searchResults count] !=0 && _listLevel<SKInvalidListLevel){
    if (_listLevel == SKCountryList) {
        _listLevel = SKCityList;
    }
    else{
        _listLevel++;
    }
    SKSearchResult *searchResult = searchResults[0];
    SKMultiStepSearchSettings* multiStepSearchObject = [SKMultiStepSearchSettings multiStepSearchSettings];
    multiStepSearchObject.listLevel = _listLevel++;
    multiStepSearchObject.offlinePackageCode = _searchSettings.offlinePackageCode;
    multiStepSearchObject.searchTerm = _searchBar.text;
    multiStepSearchObject.parentIndex = searchResult.identifier;
    [[SKSearchService sharedInstance]startMultiStepSearchWithSettings:multiStepSearchObject];
}
}


-(void)searchServiceDidFailToRetrieveMultiStepSearchResults:(SKSearchService *)searchService
{
NSLog(@"Multi Level Search failed");
}

Whatever I put as a searchTerm, I end up with "MultiLevel Search Failed".

from this screenshot, you can see that my map package for Wyoming is included in my SKMaps.bundle: (Also, if anyone can answer me this: Versioning was different in my app and in the simulator folder in the test app, from where I downloaded an offline package. So, for testing purposes, I made two folders and put Wyoming package in both of them(20140807 and 20140910). Are there any rules regarding this?)

enter image description here

What could be the problem?


Solution

  • Ok, after few days I managed to find the source of the problem.

    First, I found out which version I'm using and it's the 20140910.

    Second, For some reason, the entire folder containing maps was not recognised. So I took the entire SKMaps.bundle, together with some pre-bundled maps from the demo app, provided by the Skobbler team, and put it in my project and now everything works fine.