/* For iOS 4.1 and earlier */-(BOOL)application:(UIApplication*)applicationhandleOpenURL:(NSURL*)url{// Handle url request.UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"URL Request"message:[urlabsoluteString]delegate:nilcancelButtonTitle:@"OK"otherButtonTitles:nil];[alertshow];returnYES;}/* For iOS 4.2 and later */-(BOOL)application:(UIApplication*)applicationopenURL:(NSURL*)urlsourceApplication:(NSString*)sourceApplicationannotation:(id)annotation{// Handle url request.UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"URL Request"message:[urlabsoluteString]delegate:nilcancelButtonTitle:@"OK"otherButtonTitles:nil];[alertshow];returnYES;}
-(void)applicationDidFinishLaunching:(NSNotification*)aNotification{// Insert code here to initialize your application[[NSAppleEventManagersharedAppleEventManager]setEventHandler:selfandSelector:@selector(handleURLEvent:withReplyEvent:)forEventClass:kInternetEventClassandEventID:kAEGetURL];}-(void)handleURLEvent:(NSAppleEventDescriptor*)theEventwithReplyEvent:(NSAppleEventDescriptor*)replyEvent{// Process URL RequestNSString*path=[[theEventparamDescriptorForKeyword:keyDirectObject]stringValue];[[NSAlertalertWithMessageText:@"URL Request"defaultButton:@"OK"alternateButton:nilotherButton:nilinformativeTextWithFormat:@"%@",path]runModal];}