You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In TUSafariActivity.m there's an implementation of "canPerformWithActivityItems:(NSArray *)activityItems" that looks for an URL in the activity items. But using the method in the README here, the RDActivityViewController just passes an array of itself repeated according to the maximum number of items passed in the init method... So this method always returns NO and it won't load that activity item. It does work if I replace "self" with "placeholderItem". So why does it pass self?
But also if I replace self with placeholderItem, the link that the activity uses is the placeholder item... Doesn't seem to be calling activityViewController: itemsForActivityType for the TUSafariActivity.
Also for some reason it doesn't show Facebook or Twitter when I do get the TUSafariActivity to show.
Also depending on how I have it set up, it seems to crash (bad access) when I present the activity view controller.
Code:
-(void) share {
TUSafariActivity* safariActivity = [TUSafariActivity new];
RDActivityViewController* shareDrawer = [[RDActivityViewController alloc] initWithDelegate:self maximumNumberOfItems:3 applicationActivities:@[safariActivity] placeholderItem:[NSURL URLWithString:@"http://google.com"]];
shareDrawer.excludedActivityTypes = @[UIActivityTypePostToWeibo,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll,UIActivityTypePrint];
shareDrawer.completionHandler = ^(NSString *activityType, BOOL completed){
if (completed) {
NSLog(@"Selected activity was performed.");
} else {
if (activityType == NULL) {
NSLog(@"User dismissed the view controller without making a selection.");
} else {
NSLog(@"Activity was not performed.");
}
}
[self presentViewController:shareDrawer animated:YES completion:nil];
}
-(NSArray*) activityViewController:(NSArray *)activityViewController itemsForActivityType:(NSString *)activityType {
NSURL* url = [self shareURL];
NSString* text = [self shareText];
UIImage* image = self.eventImage.image;
if ([activityType isEqualToString:UIActivityTypePostToFacebook]) {
return @[text,url,image];
}
if ([activityType isEqualToString:UIActivityTypeCopyToPasteboard]) {
return @[url];
}
if ([activityType isEqualToString:UIActivityTypePostToTwitter]) {
return @[text,url];
}
if ([activityType isEqualToString:TUSafariActivityType]) {
return @[url];
}
return @[text,url,image];
}
The text was updated successfully, but these errors were encountered:
Setting the placeholder to nil and forcing TUSafariActivity's canPerormWithActivityItems to always return YES seems to work, but this isn't an ideal solution.
In TUSafariActivity.m there's an implementation of "canPerformWithActivityItems:(NSArray *)activityItems" that looks for an URL in the activity items. But using the method in the README here, the RDActivityViewController just passes an array of itself repeated according to the maximum number of items passed in the init method... So this method always returns NO and it won't load that activity item. It does work if I replace "self" with "placeholderItem". So why does it pass self?
But also if I replace self with placeholderItem, the link that the activity uses is the placeholder item... Doesn't seem to be calling activityViewController: itemsForActivityType for the TUSafariActivity.
Also for some reason it doesn't show Facebook or Twitter when I do get the TUSafariActivity to show.
Also depending on how I have it set up, it seems to crash (bad access) when I present the activity view controller.
Code:
The text was updated successfully, but these errors were encountered: