發佈到Web服務最簡單,因爲它直接支持瀏覽器,不需要插件。
有可用的FTP FTP客戶端庫,但這裏有一些複雜的相關內容。
電子郵件,另一方面是iOS的標準的一部分,所以即使標準插件不想要的結構,編寫一個自定義郵件插件是非常簡單的:
-(void)sendEmail:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
NSString *callback = [arguments objectAtIndex:0];
NSString *html = [arguments objectAtIndex:1];
NSString *csv= [arguments objectAtIndex:3];
NSData *csvData = [csv dataUsingEncoding:NSUTF8StringEncoding];
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
composer.mailComposeDelegate = self;
[composer setSubject:@"CSV Data"];
[composer setMessageBody:html isHTML:YES];
[controller addAttachmentData:csvData mimeType:@"text/csv" fileName:@"CSVFile.csv"];
if (composer != nil) {
[self.viewController presentModalViewController:composer animated:YES];
}
// [composer release]; // not needed with ARC
// send callback immediately - we don't need to know what happened to the mail after the UI opened
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @"Email UI opened"];
[self writeJavascript:[result toSuccessCallbackString:callback]];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self.viewController dismissModalViewControllerAnimated:YES];
}