Location:

Search Service

[Navinfo Navigation SDK for iOS] provides users with a total of 10 million POI (Point of Interest, point of interest) search service, search service simultaneous online and offline search function. At present, the provided POI search methods include: keyword search, peripheral search, type search, search along the road, and the like.

            (For complete code, see MBNewSearchListController.m of the SDKDemo project)
            // analog point
            MBPoint pos = {11637852,3986459};
            // Initialize the MBPoiSearchSession class
            self.session = [MBPoiSearchSession defaultInstance];
            // Set the query mode (default only online)
            self.session.preference = MBDataPreference_onlineOnly;
            self.session.isNearBy = YES;
            // Set the number of pages
            self.session.pageSize = 15;
            [self.session setCity:city];
            // Set search keywords
            [self.session setKeyword:@"hotel"];
            // Set the center point
            self.session.center = pos;
            // Start the query operation
            [self.session query];
            [self.session setStartedBlock:^{
                // Start the query
            }];
            [self.session setEndedBlock:^{
                // The query is successful, but the data is not loaded.
            }];
            [self.session setCanceledBlock:^{
                // cancel the query
            }];
            [self.session setFailedBlock:^(MBPoiSearchError err, NSString* detail){
                //  Query failed
            }];
            [self.session setLoadedBlock:^(NSArray *pois, NSArray *corrections, NSArray *cityDistributions, NSArray *citySuggestions, NSArray *districts) {
                // Query successful callback
                for (MBPoiItem *obj in pois){
                    NSLog(@"%@,%@",obj.name,obj.address);
                }
                NSLog(@"session pois:%@",pois);
                NSLog(@"correction:%@",corrections);
                NSLog(@"cityDistributions:%@",cityDistributions);
                NSLog(@"citySuggestions:%@",citySuggestions);
                NSLog(@"districts:%@",districts); 
            }];
        
TOP