Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7818823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:42:47+00:00 2026-06-02T06:42:47+00:00

In my app, I have implemented a private method in my AppDelegate to override

  • 0

In my app, I have implemented a private method in my AppDelegate to override the default openURL: method in order to open links inside my app within UIWebView. But now I need the default functionalities in place too.

Here’s what I did:

@implementation UIApplication (Private)

- (BOOL)customOpenURL:(NSURL*)url
{ 
    AppDelegate *MyWatcher = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    if (MyWatcher.currentViewController) {
        [MyWatcher.currentViewController handleURL:url];
        return YES;
    }
    return NO;
}

@end

- (void)applicationDidBecomeActive:(UIApplication *)application {  
    Method customOpenUrl = class_getInstanceMethod([UIApplication class], @selector(customOpenURL:));
    Method openUrl = class_getInstanceMethod([UIApplication class], @selector(openURL:));

   method_exchangeImplementations(openUrl, customOpenUrl);  
}

I also implemented handleURL: in my class where the custom open URL handling was needed. However, this is hindering my other class in which I just want to do a simple open of an iTunes link in iTunes. So what I don’t know how to achieve is how to use the original openURL: in place of customOpenURL:.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:42:50+00:00Added an answer on June 2, 2026 at 6:42 am

    You can just subclass UIApplication and override openURL: directly. Be sure to change the principle class in your Info.plist to use your UIApplication subclass.

    Example:

    @interface ECApplication : UIApplication
    
    @end
    
    @implementation ECApplication
    
    - (BOOL)openURL:(NSURL*)url
    {
    
        AppDelegate *MyWatcher = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    
        if (MyWatcher.currentViewController) {
            [MyWatcher.currentViewController handleURL:url];
            return YES;
        }
        return NO;
    }
    
    @end
    

    Then, in your Info.plist file, look for the Principle Class key, and change the value to ECApplication (or whatever you name your subclass).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a straightforward OpenID support for my ASP.NET app with DotNetOpenAuth .
I have implemented Single-Sign-On in my iOS 4.3 app successfully. Now I want to
I have implemented Membership Provider in my ASP.NET MVC app. Membership provider has the
I have a django app that I made and have implemented a plist into
I have successfully implemented printing and print preview for my app using the PrintDocument,
I have already implemented some AJAX pagination in my Rails app by using the
I have just implemented WMD for my editor in an ASP.NET app. The problem
I am developing a Silverlight app using VS2008 Express. I have just implemented a
I have an app that includes a search feature. This feature is implemented by
I have made an android app which working fine. I implemented the Login functionality

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.