I'm getting data from SOAP webservice. then add those data into a mutable array.this is my code of soap message
SoapMessage = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<GetAirport xmlns=\"http://mobileapi.bbq.uk/\">\n"
"<Authkey>%@</Authkey>\n"
"<AirportCode>%@</AirportCode>\n"
"</GetAirport>\n"
"</soap:Body>\n"
"</soap:Envelope>\n"
,AuthenticationKey, changewrd];
if changewrd=@""
, then service returns all data. if changewrd=@"a"
then service return all date which start from a.for changewrd I use textfied.text
.So what I want is if user type a in the textfield then shoud add only the data starts from a,if user type as then olny add data start from as, not the the data include as.
because with this I want to build autocomplete textfiel.
that means when user type a, should all names starts from a as code hint.then user select one from it. selected text should show as textfield.text. by filtering from the first point, I think it is easy.or if ther is any other way please get me know.this is how I add data.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
Session = [NSURLSession sharedSession];
DataTask = [Session dataTaskWithRequest:TheRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (error) {
NSLog(@"data task with request error :%@", error);
return;
}
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
if (statusCode != 200) {
NSLog(@"data task with request, HTTP status code :%ld", (long)statusCode);
return;
}
}
WebData = [[NSMutableData alloc] init];
[WebData appendData:data];
ResultString = [[NSMutableString alloc] initWithData:WebData encoding:NSUTF8StringEncoding];
TagremovedString = [self stringbyStrippingXml:ResultString];
NSError *Error;
ResultData = [TagremovedString dataUsingEncoding:NSUTF8StringEncoding];
id dictionary = [NSJSONSerialization JSONObjectWithData:ResultData options:kNilOptions error:&Error];
shortCode = [NSMutableArray array];
fullAirport = [NSMutableArray array];
for (NSDictionary *allAirports in dictionary) {
First *first = [First new];
first.fullAirport = [allAirports objectForKey:@"Airport"];
NSLog(@"%@", first.fullAirport);
[fullAirport addObject:first];
}
dispatch_async(dispatch_get_main_queue(), ^{
});
}];
[DataTask resume];
});
get all data is sucess.no idea. I have stucked with this.hope your help.thanx