I am trying to develop an ipad app that records the data from a stylus pen into a file which I can then extract to a computer for analysis.
In the app, I have a button that when pressed stores the accelerometer values of the stylus into a NSmutablearray (using startAccelerationUpdate method below) and then after a defined duration I write to a file (using endUpdates method)
- (IBAction)startWrittingBtn:(id)sender {
_writeTimer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(startAccelerationUpdates) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(endUpdates) userInfo:nil repeats:NO];
}
-(void) startAccelerationUpdates
{
self.motionManager = [JotStylusManager sharedInstance].jotStylusMotionManager;
self.motionManager.accelerometerUpdateInterval = .1;
// Update accelerometer
if (self.motionManager.accelerometerAvailable) {
NSString *strAccel = [self stringFromAccel: self.motionManager.accelerometerData.acceleration];
NSString *strTime = [self stringFromTimeInterval: self.motionManager.accelerometerData.timestamp];
NSString *strPressure = [_pressure_lb.text substringFromIndex:13];
[self.accel_val_label setText:[NSString stringWithFormat:@"%@%@",@"Accel val:",strAccel]];
[self.time_stamp setText:[NSString stringWithFormat:@"%@%@",@"Time:",strTime]];
[_stylusDataArray addObject: [NSString stringWithFormat:@"%@,%@,%@", strTime, strPressure, strAccel]];
}
}
-(void)endUpdates
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fileName = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"dataFile.plist"];
[_stylusDataArray writeToFile:fileName atomically:YES];
[_writeTimer invalidate];
NSLog(fileName);
NSLog(@"Ended");
}
Using NSLog I can see that the file is supposedly at /var/mobile/Containers/Data/Application/9D2B817D-5F0F-4121-9102-84346C6AAD7F/Documents/dataFile.plist however I don't know how to access it using iExplorer (or any other tools)
Do I have to jailbreak the ipad to do so? or is there another way to get this file?
Any advice/suggestions are welcome, thank you.