简体   繁体   English

如何让我的程序从iPhone / iPad发送客户的日志文件数据?

[英]How do I have my program send customer's log file data from their iPhone/iPad?

I am writing an enterprise client/server application. 我正在编写企业客户端/服务器应用程序。 The client is an iOS app which uses Cocoa Lumberjack to create the log files. 客户端是一个iOS应用程序,它使用Cocoa Lumberjack来创建日志文件。 These files will be essential for client debugging and troubleshooting. 这些文件对于客户端调试和故障排除至关重要。 The file will be a maximum of 1MB, although making it smaller is an option. 该文件最大为1MB,但可以选择较小的文件。

I planned to code a "email log file" button but I can't figure out how to send it as an attachment. 我打算编写一个“电子邮件日志文件”按钮,但我无法弄清楚如何将其作为附件发送。 I suppose I could stuff the email's body with all my log messages, but that seems a bit ugly. 我想我可以用我所有的日志消息填充电子邮件的正文,但这看起来有点难看。 What if I want to compress the file into a non-text format before sending? 如果我想在发送之前将文件压缩为非文本格式,该怎么办? I've also considered creating a web service to upload the log file to the server but this seems like a lot of work, as I would then need to sort out who's log file is who's and have some kind of purge to keep it neat, etc. 我还考虑过创建一个Web服务来将日志文件上传到服务器,但这似乎需要做很多工作,因为我需要弄清楚谁的日志文件是谁,并进行某种清除以保持整洁,等等

Surely I'm not the first to face this issue. 当然,我不是第一个面对这个问题的人。 How is everyone else doing this? 别人怎么做这个?

Thanks in advance for any help you can give me. 在此先感谢您提供给我的任何帮助。

Here's some complete working code that creates an email, adds a HTML body, adds a text attachment, and sends shows the compose view. 这里有一些完整的工作代码,用于创建电子邮件,添加HTML正文,添加文本附件以及发送显示撰写视图。

Make sure you also define path for resource. 确保您还定义资源的路径。

NSData *textData = [[self getEmailAttachment] dataUsingEncoding:NSUTF8StringEncoding];
NSString *htmlData = [self getEmailBodyHTML];

/* Set up the mail compose view and put in the body/attachment */
MFMailComposeViewController *mailComposer = [[[MFMailComposeViewController alloc] init] autorelease];
[mailComposer setMessageBody:htmlData isHTML:NO];
[mailComposer addAttachmentData:textData mimeType:@"text/plain" fileName:@"logfile.txt"];

/* Set default subject */
[mailComposer setSubject:@"Email subject"];

mailComposer.mailComposeDelegate = self;        
[self presentModalViewController:mailComposer animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您如何通过iPhone / iPad将用户发送到您的应用设置? - How do you send a user to your app's settings from iPhone/iPad? 如何在iPhone / iPad模拟器上运行IPA文件? - How do I run an IPA file on an iPhone/iPad simulator? 如何在iPhone / iPad SDK中从Internet下载或打开.docx,.pdf,.zip和视频文件 - How do I download or open .docx,.pdf,.zip and video file from internet in iphone/ipad SDK 如何从我的代码访问 iPhone 的设置? - How do I access the iPhone's settings from my code? 我如何从javascript到iPhone / iPad获得价值? - How do I get value from javascript to iphone/ipad? 如何将文件从S3下载到iPhone应用程序? - How do I download a file from S3 to an iPhone application? 我的 iphone 应用程序如何将数据发送到服务器的 php 文件? - How can my iphone app send data to the server's php file? 如何在真正的iPhone上运行我的应用程序? (我有我同事的证明) - How do I run my app on real iPhone? (i have a certificate from my coworker) 我不知道如何正确使用CSS文件中的媒体选择器来确定要为iPhone或iPad加载的图像 - I do not know how to use media selectors in my css file correctly to decide which image to load for iPhone or iPad 在iPhone / iPad上获取样本数据的好方法是什么? - What's a good way to have sample data on the iPhone/iPad?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM