/// 檢索基礎(chǔ)信息類,所有類型Poi檢索的基類 @interface BMKBasePoiSearchOption : NSObject { NSString*_keyword; int _pageIndex; int _pageCapacity; } ///搜索關(guān)鍵字 @property (nonatomic, strong) NSString *keyword; ///分頁索引,可選,默認(rèn)為0 @property (nonatomic, assign) intpageIndex; ///分頁數(shù)量,可選,默認(rèn)為10,最多為50 @property (nonatomic, assign) intpageCapacity;
///poi詳情檢索信息類 @interface BMKPoiDetailSearchOption : NSObject { NSString* _poiUid; } ///poi的uid,從poi檢索返回的BMKPoiResult結(jié)構(gòu)中獲取 @property (nonatomic, strong) NSString* poiUid;
#pragma mark - 發(fā)起poi檢索 -(void)beginSearchWithCenter:(CLLocationCoordinate2D)center andKeyWord:(NSString *)key { // 發(fā)起檢索 BMKNearbySearchOption *nearBySearchOption = [[BMKNearbySearchOption alloc]init]; nearBySearchOption.pageIndex= 0; nearBySearchOption.pageCapacity = 20; nearBySearchOption.location = center; nearBySearchOption.keyword= key; nearBySearchOption.radius = 5000; BOOL flag = [self.poisearch poiSearchNearBy:nearBySearchOption];if(flag) { //NSLog(@"周邊檢索發(fā)送成功"); TAG = 7; } else { //NSLog(@"周邊檢索發(fā)送失敗"); } } }
#pragma mark - 返回搜索結(jié)果 //實(shí)現(xiàn)PoiSearchDeleage處理回調(diào)結(jié)果 /***返回POI搜索結(jié)果*@param searcher 搜索對(duì)象*@param poiResult 搜索結(jié)果列表*@param errorCode 錯(cuò)誤號(hào),@see BMKSearchErrorCode// */ - (void)onGetPoiResult:(BMKPoiSearch*)searcher result:(BMKPoiResult*)poiResultList errorCode:(BMKSearchErrorCode)error {if (error == BMK_SEARCH_NO_ERROR) { // 在此處理正常結(jié)果x self.mudata = [NSMutableArray new]; // 搜索結(jié)果數(shù)據(jù)源數(shù)組要在這里初始化,才會(huì)每次請(qǐng)求都有不一樣的數(shù)據(jù)進(jìn)去數(shù)組[poiResultList.poiInfoList enumerateObjectsUsingBlock:^(BMKPoiInfo*_Nonnull poiInfo, NSUInteger idx, BOOL * _Nonnull stop) { // 閉包SearchModel *MyModel = [[SearchModel alloc] init];if (MyModel) {// MyModel值不能為空MyModel.name = poiInfo.name; MyModel.address= poiInfo.address; MyModel.phone= poiInfo.phone; [self.mudata addObject:MyModel];self.poiUid = poiInfo.uid; // 取得uid// 發(fā)起POI詳情檢索 BMKPoiDetailSearchOption *detailSearchOption = [[BMKPoiDetailSearchOption alloc]init]; detailSearchOption.poiUid = self.poiUid; BOOL flag1 = [self.poisearchDetail poiDetailSearch:detailSearchOption];if(flag1) { NSLog(@"周邊檢索發(fā)送成功"); TAG = 7; } else { NSLog(@"周邊檢索發(fā)送失敗"); } } else {//NSLog(@"搜索結(jié)果模型沒有值"); return;} }]; } }
/***返回POI詳情搜索結(jié)果*@param searcher 搜索對(duì)象*@param poiDetailResult 詳情搜索結(jié)果*@param errorCode 錯(cuò)誤號(hào),@see BMKSearchErrorCode*/ - (void)onGetPoiDetailResult:(BMKPoiSearch*)searcher result:(BMKPoiDetailResult*)poiDetailResult errorCode:(BMKSearchErrorCode)errorCode { NSLog(@"POI詳情搜索結(jié)果方法走了");NSLog(@"errorCode:%u",errorCode);NSLog(@"poiDetailResult detailUrl%@",poiDetailResult.detailUrl); }
POI詳情搜索返回方法這個(gè)方法不走,麻煩幫忙看看問題出在哪。謝謝~