這是你如何Twitter並做到這一點,你必須進行適當的修改,以將其用於郵件:
if (![TwitterSettings hasAccounts]) {
//NSLog(@"UnAvailable");
[TwitterSettings openTwitterAccounts];
}
//
// TwitterSettings.m
//
//
#import "TwitterSettings.h"
@implementation TwitterSettings
+ (BOOL)hasAccounts {
// For clarity
return [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter];
}
+ (void)openTwitterAccounts {
SLComposeViewController *ctrl = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
if ([ctrl respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) {
// Manually invoke the alert view button handler
[(id <UIAlertViewDelegate>)ctrl alertView:nil
clickedButtonAtIndex:kTwitterSettingsButtonIndex];
}
// [ctrl release];
}
@end