アプリで生成した CSV ファイルがいくつかあります。デスクトップ コンピューターにファイルを取得して、古き良き時代の数値計算を行うための実行可能な方法を探しています。当分の間、ファイルは CSV のままにしておく必要があります。これは、デスクトップ アプリケーションが使用するものです。ファイル転送方法があるようですが、投稿を使用してファイルを送信しているように見えますが、このソフトウェアに Web サービスの依存関係を持たせたくありません。メールを使おうと思ったのですが、添付ファイルを追加できないようです。本当にうまくいくのは素晴らしい FTP クライアントですが、Android 用のプラグインしか見つけられませんでした。
1 に答える
0
Web サービスへの投稿は、ブラウザーによって直接サポートされているため、プラグインは必要ないため、最も簡単です。
利用可能な iOS 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];
}
于 2012-11-16T02:53:32.247 に答える