この質問には次のような回答があります。
https://stackoverflow.com/a/7648354/1272540
したがって、ShareKitPlugin.m に以下を追加します。
- (void)shareToMail:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
[SHK setRootViewController:self.viewController];
SHKItem *item;
NSString *subject = [arguments objectAtIndex:1];
NSString *body = [arguments objectAtIndex:2];
item = [SHKItem text:body];
item.title = subject;
// **start of added code
NSString *recipient = [arguments objectAtIndex:3];
[item setCustomValue:recipient forKey:@"toField"];
// **end of added code
[SHKMail shareItem:item];
}
そしてこれはSHKMail.mにあります:
[mailController setSubject:self.item.title];
[mailController setMessageBody:body isHTML:YES];
// **start of added code
NSString *recipient = [self.item customValueForKey:@"toField"];
NSLog(@"recipient: %@", recipient);
if (recipient != nil) {
NSArray *recipients = [[NSArray alloc] initWithObjects:recipient, nil];
[mailController setToRecipients:recipients];
[recipient release];
[recipients release];
}
// **end of added code
[[SHK currentHelper] showViewController:mailController];
および ShareKitPlugin.js で:
ShareKitPlugin.prototype.shareToMail = function( subject, message , recipient)
{
if(typeof recipient === undefined){
recipient = '';
}
cordova.exec(null, null, "ShareKitPlugin", "shareToMail", [subject, message , recipient] );
};
このコードは gitHub からのものです: https://github.com/ideashower/ShareKit/issues/281