Open and Share buttons

Discussion in 'iOS Programming' started by Macintosh1984, Aug 25, 2016.

  1. Macintosh1984, Aug 25, 2016
    Last edited: Aug 25, 2016

    Macintosh1984 macrumors regular

    Dec 15, 2012

    I'm new to iOS programming and I'm using a snipped code to Open into Safari an Share link of a WordPress post showed into my app by JSON API plugin.

    The app is connected to a WordPress installation into a subdomain, like, the normal site is instead

    How to change the URL of "Open" and "Share" replacing "app." with "www." so clicking user can see the normal site and not the dedicated app site?

    I think that the code to modify is this:

    - (void)open
        [AppDelegate openUrl:_articleUrl withNavigationController:self.navigationController];
    - (IBAction)share:(id)sender
        NSArray *activityItems = [NSArray arrayWithObjects:_articleUrl,  nil];
        [self presentActions:activityItems sender:(id)sender];
        //[self showDisqusComments];
    You can help me?
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    You can use NSURL to edit URLs. Make a NSURL object with your string. You can then use the correct hostname and build a new NSURL with one of the appropriate init methods and the path from your first NSURL object.
  3. Macintosh1984 thread starter macrumors regular

    Dec 15, 2012
    Thanks! Can you provide me some snippet to use? At the moment I do not know how to move forward. If necessary, I'll post some other piece of code for Capore how it works now the "Open" and "Share" service.

Share This Page