ios - NSUserActivity : indexing multiple NSUserActivities using loop -
i want index multiple nsuseractivities
of same type. code same given below:
-(void)createactivityforeachcity:(nsnotification *)notification { nsarray *namelist = @[@"name1",@"name2",@"name3",@"name4"]; if (namelist) { (nsstring *name in namelist) { [self createindexactivityforname:name]; } } } -(void)createindexactivityforname:(nsstring*)name { nsuseractivity *activity = [[nsuseractivity alloc]initwithactivitytype:@"spotlightsearchactivity"]; nsdictionary *activityuserinfo = @{@"name":name}; activity.userinfo = activityuserinfo; activity.title = [nsstring stringwithformat:@"you searched %@",name]; activity.eligibleforhandoff = no; activity.eligibleforsearch = yes; activity.eligibleforpublicindexing = yes; self.useractivity = activity; [activity becomecurrent]; }
from above code, nsuseractivities name1, name2, name3 , name4
must created. getting is, nsuseractivity being overridden i.e., name4
getting indexed.
what missing in code? please help..!!
Comments
Post a Comment