Hi! Im working on an gesture recognition application which in short terms do the following;
- gather accelerometerdata when a button is pushed/released and stores this "sample of data". Then the user can do this for a few times and then when he has made enough "sample runs", i make a template out of it using median. After this is made the user pushes a new button performs a gesture, and then the two are compared to check how related the template and "probe" gesture is.
This is a small part of my overall project, and i had it "finished" in simulator, and tested that everything worked fine with feeding it data manually.
When i now went live on my Ipod Touch, the application hans when its supposed to generate the template and provides me with the following error message;
2010-02-01 15:50:36.092 Accelerate[1279:207] *** -[NSCFArray xmedianarray]: unrecognized selector sent to instance 0x126a10
2010-02-01 15:50:36.101 Accelerate[1279:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray xmedianarray]: unrecognized selector sent to instance 0x126a10'
I've tried debugging where it comes from and i traced it to here;
which is called in the following fashion;
I have 4classes; accelerateappdelegate class, probe class, template class, and a storage class.
which are defined as follows;
Note: i just took out the informatoin i though would be valuable for you to see, if you want i can post the entire code, if you cannot see the problems here. I get no errors or warnings when compiling in Xcode.
I must note that i recently migrated over to the apple platform, and that therefore my programming skills in Cocoa/ObjC is not top notch. The error is probably some noob mistake, but i really hope you take the time to help me anyways, it is greatly appreciated!
Thank you in advance
- gather accelerometerdata when a button is pushed/released and stores this "sample of data". Then the user can do this for a few times and then when he has made enough "sample runs", i make a template out of it using median. After this is made the user pushes a new button performs a gesture, and then the two are compared to check how related the template and "probe" gesture is.
This is a small part of my overall project, and i had it "finished" in simulator, and tested that everything worked fine with feeding it data manually.
When i now went live on my Ipod Touch, the application hans when its supposed to generate the template and provides me with the following error message;
2010-02-01 15:50:36.092 Accelerate[1279:207] *** -[NSCFArray xmedianarray]: unrecognized selector sent to instance 0x126a10
2010-02-01 15:50:36.101 Accelerate[1279:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray xmedianarray]: unrecognized selector sent to instance 0x126a10'
I've tried debugging where it comes from and i traced it to here;
Code:
-(void) addToMedianTemplate: (template *) temp: (int) i{ // intermediate function for the median calculation
NSDecimalNumber *tmpval;
if([xarray count]-1 >= i){
tmpval = [xarray objectAtIndex:i];
[temp.xmedianarray addObject:tmpval]; [B]// HERE IS ERROR[/B]
tmpval = [yarray objectAtIndex:i];
[temp.ymedianarray addObject:tmpval];
tmpval = [zarray objectAtIndex:i];
[temp.zmedianarray addObject:tmpval];
}
}
which is called in the following fashion;
Code:
-(IBAction)GenTemplate{ // median compare
int longest_array=0;
for(storage *stor ingestures){
int x = [stor arraylength:'x'];
if(longest_array < x)
longest_array =x;
}
for(int i=0; i <longest_array; i++){
for(storage *stor2 ingestures){
[stor2 addToMedianTemplate:temp:i];
}
[temp sort_array];
[temp mediancalc];
// clear the temp arrays before moving on to next i (x,y,z value instance)
[temp .xmedianarrayremoveAllObjects];
[temp .ymedianarrayremoveAllObjects];
[temp .zmedianarrayremoveAllObjects];
}
}
I have 4classes; accelerateappdelegate class, probe class, template class, and a storage class.
which are defined as follows;
Code:
@interface storage : NSObject {
NSMutableArray *xarray;
NSMutableArray *yarray;
NSMutableArray *zarray;
}
@interface AccelerateAppDelegate : NSObject <UIApplicationDelegate,UIAccelerometerDelegate> {
UIWindow *window;
IBOutletUILabel *xLabel;
IBOutletUILabel *yLabel;
IBOutletUILabel *zLabel;
IBOutletUILabel *Total;
IBOutletUILabel *decision;
IBOutlet UILabel *difference;
int pushed,pushed2;
IBOutlet UIActivityIndicatorView * act;
IBOutlet UIButton *startbutton;
IBOutlet UIButton *gentempbutton;
IBOutlet UIButton *probebutton;
NSMutableArray *gestures;
storage *run;
template *temp;
probe *probee;
}
@interface probe : NSObject {
NSMutableArray *probex;
NSMutableArray *probey;
NSMutableArray *probez;
}
@property (copy) NSMutableArray *probex;
@property (copy) NSMutableArray *probey;
@property (copy) NSMutableArray *probez;
@interfacetemplate : NSObject {
// The arrays below hold the template of the gesture for this session
NSMutableArray *templx;
NSMutableArray *temply;
NSMutableArray *templz;
NSMutableArray *xmedianarray;
NSMutableArray *ymedianarray;
NSMutableArray *zmedianarray;
}
@property (copy) NSMutableArray *templx;
@property (copy) NSMutableArray *temply;
@property (copy) NSMutableArray *templz;
@property (copy) NSMutableArray *xmedianarray;
@property (copy) NSMutableArray *ymedianarray;
@property (copy) NSMutableArray *zmedianarray;
Note: i just took out the informatoin i though would be valuable for you to see, if you want i can post the entire code, if you cannot see the problems here. I get no errors or warnings when compiling in Xcode.
I must note that i recently migrated over to the apple platform, and that therefore my programming skills in Cocoa/ObjC is not top notch. The error is probably some noob mistake, but i really hope you take the time to help me anyways, it is greatly appreciated!
Thank you in advance