如何将 NSUserDefaults.StandardUserDefaults 序列化为支持电子邮件的文本?

发布于 2024-10-01 14:12:28 字数 224 浏览 0 评论 0原文

我使用 Monotouch 进​​行 iPhone/iPad 开发,并且有一个内置系统,用户可以在其中从应用程序提交错误报告。如果能捕获我存储在 NSUserDefaults.StandardUserDefaults 中的“设置”,这样我就可以看到它们的确切配置。

有人知道如何捕获 NSUserDefaults.StandardUserDefaults 并写入文本或文件以包含在电子邮件中吗?

谢谢。

I'm using Monotouch for iPhone/iPad development and I have a built in system where the user can submit a bug report from the app. It would be nice to capture their "settings" which I store in NSUserDefaults.StandardUserDefaults so I can see their exact configuration.

Anyone know how to capture the NSUserDefaults.StandardUserDefaults and write out to text or file to include in the e-mail?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

那支青花 2024-10-08 14:12:28

您可以将 NSUserDefaults 保存为 plist。在另一端解码可能更容易。

NSDictionary *defaults = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
[defaults writeToFile:@"path" atomically:YES];

[编辑]

我不知道这是否有效。

var = NSUserDefaults.StandardUserDefaults.DictionaryRepresentation();

或者只是循环浏览您的属性并将它们打印到文件中?

NSUserDefaults.StandardUserDefaults.StringForKey("thisorthatKey");

You could save the NSUserDefaults as a plist. Might be easier to de-code on the other end.

NSDictionary *defaults = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
[defaults writeToFile:@"path" atomically:YES];

[EDIT]

I have no idea if this will work.

var = NSUserDefaults.StandardUserDefaults.DictionaryRepresentation();

Or just cycle through your properties and print them to a file?

NSUserDefaults.StandardUserDefaults.StringForKey("thisorthatKey");
如果没有 2024-10-08 14:12:28

我最终只是将 .plist 文件直接附加到电子邮件中,效果很好。

I ended up just attaching the .plist file directly to the e-mail and that worked just fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文