开发者

How to serialize NSUserDefaults.StandardUserDefaults to text for support e-mail?

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 "se开发者_开发百科ttings" 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.


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");


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜