I'm trying to collect data for a machine learning project I'm working on. What I'd like to do is collect accelerometer data from an iPhone, save it to a csv and email it to myself. My app currently is able to acquire data from the accelerometer, but I'm at a bit of a loss as to how to proceed. First of all, I'd like to acquire data for a preset amount of time (after playing a sound to the user) which I don't really know how to do, and I can't find good 开发者_Go百科documentation for. Also, I'd like to save that to a csv, which there is some documentation on (specifically using the NSString writeToFile method). Any recommendations/ ideas?
Thanks!
Take it one step at a time.
You can set an NSTimer to get a callback at some point in the future and at the callback you can stop your data acquisition.
EDIT: You can also use a performSelector:withObject:afterDelay: to get a callback after a time delay to stop data acquisition.
This SO question has answers with example code for both methods.
精彩评论