Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Macintosh1984

macrumors 6502
Original poster
Dec 15, 2012
324
46
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?
 
Last edited:

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
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.
 

Macintosh1984

macrumors 6502
Original poster
Dec 15, 2012
324
46
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.