1

i have some images & text that i want to share via Facebook,twitter ,it works fine , although i want to share another set of data ( activityitems ) with my custom UIActivity

 NSLog(@"The Selected Photo Count %i",[self.selectedPhotos count]);

NSMutableArray *newArray=[[NSMutableArray alloc]init];
NSMutableArray *newArraytext=[[NSMutableArray alloc]init];



for (Shoplog * ChosenPhot in self.selectedPhotos) {

    NSString *initalTextString = [NSString
                                  stringWithFormat:@"I am Sending from my Shoplog Collection: %@",
                                  ChosenPhot.categoryname];

    [newArraytext addObject:initalTextString];
    CreateShoplogTagImage *createimagetag=[[CreateShoplogTagImage alloc]init];
    UIImage *newimage=[createimagetag Imagetag:ChosenPhot];
    NSDictionary *flurrydicttionary3=[[NSDictionary alloc]initWithObjectsAndKeys:ChosenPhot.categoryname,@"SharedCategoryname", nil];
    [Flurry logEvent:@"SharedCatalogue" withParameters:flurrydicttionary3 timed:YES];
    [newArray addObject:newimage];

}


NSMutableArray *addArray=[[NSMutableArray alloc]initWithArray:newArray];
[addArray addObjectsFromArray:newArraytext];


UIActivityViewController *activityViewController2 =[[UIActivityViewController alloc]initWithActivityItems:addArray applicationActivities:@[shopactivity]];

[self presentViewController:activityViewController2 animated:YES completion:^{}];
TALAA
  • 6,184
  • 1
  • 13
  • 21

1 Answers1

1

You should subclass UIActivityItemProvider or create objects that conform to UIActivityItemSource. Pass in an array of those, and have some of them return nil depending on the chosen activity in the activityViewController:itemForActivityType: call.

ccjensen
  • 4,578
  • 2
  • 23
  • 25