You should add a flag overrideindicating whether you want to control or not.
@interface MyApplication : UIApplication {
}
-(BOOL)openURL:(NSURL *)url withOverride:(BOOL)override;
@end
@implementation MyApplication
-(BOOL)openURL:(NSURL *)url withOverride:(BOOL)override {
if ( !override ) {
return [super openURL:url];
}
if ([self.delegate openURL:url]) {
return YES;
} else {
return [super openURL:url];
}
}
-(BOOL)openURL:(NSURL *)url{
return [self openURL:url withOverride:YES];
}
@end
So, now all the calls that you want to get around can be sent this way.
[[MyApplication sharedApplication] openURL:url withOverride:NO];
Original answer
This is what you should do. Place it in front of the operator return YES;.
if ( [super canOpenURL:aURL] ) {
return [super openURL:aURL];
}