So I'm trying to open a view within an app from a button press and I'm shown the following error:
'NSInvalidArgumentException', reason: '-[UINavigationBar copyWithZone:]: unrecognized selector sent to instance 0x1e56aa10'
The action for the button press is:
-(IBAction)launchDirections:(id)sender
{
@autoreleasepool {
if([CLLocationManager locationServicesEnabled]){
if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied
|| [CLLocationManager authorizationStatus]==kCLAuthorizationStatusNotDetermined
|| [CLLocationManager authorizationStatus]==kCLAuthorizationStatusRestricted ){
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied"
message:@"To re-enable, please go to Settings and turn on Location Service for this app."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else{
NSLog(@"Location Services Enabled");
ontracDirectionsMapViewController *directions = [[ontracDirectionsMapViewController alloc] init];
directions.start = userLocation;
directions.end =selectedPointLocation;
//[self presentViewController:directions animated:NO completion:nil];
//[self.navigationController pushViewController:directions animated:YES];
[ self presentViewController : directions animated : YES completion : ^ {
NSLog ( @ "hello" );
}];
}
}
}
}
Additionally I have tried the two lines you can see that have been commented out:
//[self presentViewController:directions animated:NO completion:nil];
//[self.navigationController pushViewController:directions animated:YES];
These don't make any difference unfortunately. I'm new to IOS development and not sure where to go from here.
Additionally there is a method elsewhere in the app called copyWithZone
but even if i remove this entirely I still get the error with the reference.
-(id)copyWithZone:(NSZone *)zone
{
ontracTableMasterViewController *copy = [[ontracTableMasterViewController alloc] init];
copy.cookieValue = self.cookieValue;
copy.dataObject = self.dataObject;
return copy;
}