Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I can't provide a subject for UIActivityItemProvider, as per this stack overflow answer. it appears to be missing from the class!! That makes it impossible to provide a subject.
It's not missing since it's not an API that's part of that type, even in ObjC.
`UIActivityItemProvider` is too general to know details about each provider. However you can pass data along (just like the ObjC answer did on SO) like this:
UIActivityViewController avc = new UIActivityViewController (...);
avc.SetValueForKey (new NSString ("Your email Subject"), new NSString ("subject"));
At that point it's up to the provider to retrieve the data (subject) and do something with it.
Okay, that actually worked. Thanks for clarifying. I was confused because:
NS_CLASS_AVAILABLE_IOS(6_0) @interface UIActivityItemProvider : NSOperation <UIActivityItemSource>
in objective c it conforms to UIActivityItemSource
@protocol UIActivityItemSource <NSObject>
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController; // called to determine data type. only the class of the return type is consulted. it should match what -itemForActivityType: returns later
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType; // called to fetch data after an activity is selected. you can return nil.
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType; // if activity supports a Subject field. iOS 7.0
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController dataTypeIdentifierForActivityType:(NSString *)activityType; // UTI for item if it is an NSData. iOS 7.0. will be called with nil activity and then selected activity
- (UIImage *)activityViewController:(UIActivityViewController *)activityViewController thumbnailImageForActivityType:(NSString *)activityType suggestedSize:(CGSize)size; // if activity supports preview image. iOS 7.0
And on iOS we implement the optional method subjectForActivityType:(NSString *)activityType
However, for now it solves my issue, and to be honest, these apis are the worst I've found in 5 years of cococa development (Lord knows what hapless noobies they let create the activity view controller mess). Someone, somewhere might want to be able to implement that delegate method to get fine grained, per activity type subject text; but I'm not that person, so unless you're worried about them, keep it resolved/fixed.
I missed the `UIActivityItemSource` protocol when checking this last night. I'll have a second look
> these apis are the worst
IMO the keychain API is even worse ;-)