Hello,
I'm getting the above error and have no idea where its happening. Is there any way to debug it. I've put in some breaks points already buts its not abending its not abending those areas.
Code below:
-(void)viewDidLoad
{
if (managedObjectContext == nil)
{
managedObjectContext = [(NewWorkoutViewController *)[[UIApplication sharedApplication] delegate] managedObjectContext];
NSLog(@"After managedObjectContext: %@", managedObjectContext);
}
//Setup PickerView values.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 480);
pickerView.transform = transform;
[UIView commitAnimations];
// When the view loads, run this action.
[super viewDidLoad]; // This NEEDS to be here or the application will not work!
route.delegate = self;
//Initialise variable.
counterInt = 0;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch;
touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
if (CGRectContainsPoint([route frame],point))
{
[self routePickerShow];
}
if (CGRectContainsPoint([activity frame],point))
{
[self activityPickerShow];
}
if (CGRectContainsPoint([intensity frame],point))
{
[self intensityPickerShow];
}
}
-(IBAction)routePickerShow
{
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Route" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];
// Check for errors from the FetchRequest
if (nil == results || nil != error)
NSLog(@"Error getting results : %@", error);
routeArray = [results mutableCopy];
[request release];
int arrayItemQuantity = [routeArray count];
NSLog(@"Array Quantity: %d", arrayItemQuantity);
int i;
for (i = 0; i < arrayItemQuantity; i++)
{
NSLog(@"Element %i: %@", i, [[routeArray objectAtIndex:i] valueForKey:@"route_name"]);
NSLog(@"Element %i: %@", i, [[routeArray objectAtIndex:i] valueForKey:@"route_id"]);
}
// Initialise PickerView details.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 200);
pickerView.transform = transform;
[self.view addSubview:pickerView];
[UIView commitAnimations];
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)routePicker
{
return 1;
}
-(NSInteger)pickerView:(UIPickerView *)routePicker numberOfRowsInComponent:(NSInteger)component
{
return [routeArray count];
}
-(NSString *)pickerView:(UIPickerView *)routePicker titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [routeArray objectAtIndex:row];
}
-(void)pickerView:(UIPickerView *)routePicker didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
route.text = [[routeArray objectAtIndex:row] valueForKey:@"route_name"];
mapID = [[routeArray objectAtIndex:row] valueForKey:@"route_id"];
NSLog(@"Map ID NW: %@", mapID);
//activity.text = [list objectAtIndex:row];
//intensity.text = [list objectAtIndex:row];
}
All I know is that its not getting as far a the method pickerView, it abends before this.