LinkedIn & Google+ UIActivity View Controller Butt

2020-03-30 04:24发布

I understand that there is a Facebook & Twitter button for the UIActivity View Controller, but I was wandering if there was a service for sharing to Google+ or LinkedIn through the UIActivityViewController?

1条回答
手持菜刀,她持情操
2楼-- · 2020-03-30 04:44

There is not one for each available in apple provided types, but you can create your own. You can create an UIActivity class and pass it into the UIActivityViewController to handle sending data to each of the services you are looking to interactive with:

DataItemProvider *dataToShare = [[DataItemProvider alloc] initWithPlaceholderItem:FileTypeToShare];

GooglePlusActivityType *googleActivity = [[GooglePlusActivityType alloc] init];
LinkdInActivityType *linkdinActivity = [[LinkdInActivityType alloc] init];

NSArray *activityTypes = @[googleActivity, linkdinActivity];
NSArray *activityItems = @[dataToShare];

UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:activityTypes];

[activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
    //Put in your completion handle code here.
}];

[self presentViewController:activityController animated:YES completion:nil];

Then implement classes for both GooglePlusActivityType and LinkdInActivityType to handle loading the data to the two sites.

查看更多
登录 后发表回答