objective c - Post multiple image using share extension in iOS -


i want share or post multiple image in app using app share extension. using below code.

for (nsitemprovider* itemprovider in ((nsextensionitem*)self.extensioncontext.inputitems[0]).attachments ) {      if([itemprovider hasitemconformingtotypeidentifier:@"public.png"]) {         nslog(@"itemprovider = %@", itemprovider);          [itemprovider loaditemfortypeidentifier:@"public.png" options:nil completionhandler: ^(id<nssecurecoding> item, nserror *error) {              nsdata *imgdata;             if([(nsobject*)item iskindofclass:[nsurl class]]) {                 imgdata = [nsdata datawithcontentsofurl:(nsurl*)item];             }             if([(nsobject*)item iskindofclass:[uiimage class]])             {                  //imgdata = uiimagejpegrepresentation((uiimage*)item, 1.0);                 imgdata = uiimagepngrepresentation((uiimage*)item);             }              nsdictionary *dict = @{                                    @"imgdata" : imgdata,                                    @"name" : self.contenttext                                    };             nsuserdefaults *defaults = [[nsuserdefaults alloc] initwithsuitename:@"group.com.example”];             [defaults setobject:dict forkey:@"img"];             [defaults synchronize];               [self.extensioncontext completerequestreturningitems:@[]                                                completionhandler:nil];          }];      } } 

how can post multiple image , changes have in post code. happy coding :) waiting positive response.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo