IOS9 new features searchable search

Source: Internet
Author: User

Code needs to run on iOS9 or later

Need to increase the system version of the judgment

#pragma  mark - searchable search + (void) addsearchableitem{         cssearchableitemattributeset *attributeset = [[cssearchableitemattributeset alloc]  initwithitemcontenttype:@ "Duwu. Topic.test "];    attributeset.title = @" title ";     attributeset.contentdescription = @ "content";     //tried to pass the URL in   seems to be a picture that does not show the network /    attributeset.thumbnailurl = [nsurl urlwithstring:@ "ImageURL"];         attributeset.keywords = @[@ "Can", @ "Add", @ "multiple", @ "keywords"];     //because I have no local image to display   and add to searchable search as if not much real-time   I took a sub-thread to download pictures and other images downloaded in the Add to the search bar method      dispatch_async (Dispatch_get_global_queue (0, 0), ^{                 nsdata *_thumbnaildata =  [[nsdata alloc] initwithcontentsofurl:attributeset.thumbnailurl];         attributeSet.thumbnailData = _thumbnailData;                 cssearchableitem *_item = [[ cssearchableitem alloc] initwithuniqueidentifier:@ "A special ID that makes it easy for users to click into the app and treat it differently"  domainidentifier:@ "Group Info"  attributeSet:attributeSet];                 //Delete a grouped searchable search         [[ cssearchableindex defaultsearchableindex] deletesearchableitemswithdomainidentifiers:@[@ "group Information"]  completionhandler:^ (Nserror * _nullable error)  {         }];                 //add information to searchable search    &nbsP;    [[cssearchableindex defaultsearchableindex] indexsearchableitems:@[_item]  completionhandler:^ (Nserror * _nullable error)  {         }];            });     }


This article is from the "Low profile" blog, please be sure to keep this source http://liyun2422.blog.51cto.com/9161506/1732212

IOS9 new features searchable search

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.