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

    Joined:
    Dec 15, 2012
    #1
    Hi

    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 app.mysite.com, the normal site is instead www.mysite.com.

    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:

    Code:
    - (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 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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

    Joined:
    Dec 15, 2012
    #3
    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