I am using an UIActivityViewController to show share options. The information I am trying to share consists of two pieces (a plain string and an url). The share is working through all the extensions like iMessages, Mail, Notes, Twitter, Facebook etc, but the app is crashing when I try to share through Slack. The weird thing is that the crash only happens if I am not debugging and it never crashes while debugging.
Code:
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[title, self] applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
# UIActivityItemSource methods
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
return url;
}
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
return url;
}
- (NSString*)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType {
return title;
}
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController dataTypeIdentifierForActivityType:(NSString *)activityType {
return @"com.test.url";
}
- (UIImage *)activityViewController:(UIActivityViewController *)activityViewController thumbnailImageForActivityType:(NSString *)activityType suggestedSize:(CGSize)size {
return image;
}
I also noticed that this crash is happening on the Flipboard app and it's working fine on the Twitter app.
Did anyone run into this issue? If so can you please let me know what's the issue and how this can be fixed?