001
001

Reputation: 65117

iPhone - press button open URL?

1) user launch application 2) user press button 3) button loads http://domain.com/mypage/?item=123

How do you trigger http://domain.com/?item=123, without opening the actual page in the browser?

Upvotes: 0

Views: 806

Answers (4)

Evan
Evan

Reputation: 6161

NSString* str = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://domain.com/?item=123"] usedEncoding:NULL error:NULL]

Upvotes: 0

Joseph Nardone
Joseph Nardone

Reputation: 457

I have used a UIWebView set to "hidden". It probably is not the most efficient way but if you normally use UIWebViews and Interface Builder then it is easy. You can also use the webview delegate methods to watch it.

On second thought - use the NSURL String method above but put it in a new thread.

Upvotes: -1

Costique
Costique

Reputation: 23722

NSURLConnection is the answer.

Upvotes: 3

donkim
donkim

Reputation: 13137

Not 100% sure of what the question is, but you could use a UIWebView. Load that UIWebView in the app with the URL and you should be good to go.

Hope this helps!

Upvotes: 0

Related Questions