Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-20-2008, 07:37 PM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 9
alexanderMobile is an unknown quantity at this point
Default URL schemes in table cells

Hi,

The documents mention you can use different URL schemes like mailto and tel to open up mail or make a call. How would you integrate this so when a table's cell is clicked, it performs the equivalent of if a mailto hyperlink was clicked?
alexanderMobile is offline   Reply With Quote
Old 04-20-2008, 10:41 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Location: Onomatopoeia, Lugubriousylvania
Posts: 225
bonehead is an unknown quantity at this point
Default Re: URL schemes in table cells

You need to implement a UITableViewDelegate method in e.g. your UIViewController subclass:

- (void)tableViewUITableView *)tableView selectionDidChangeToIndexPathNSIndexPath *)newIndexPath fromIndexPathNSIndexPath *)oldIndexPath

Assuming your table cell references a URL you can simply launch that URL using:

UIApplication* theApp = [UIApplication sharedApplication]; //get application singleton
[theApp openURL: url];
bonehead is offline   Reply With Quote
Old 04-20-2008, 11:19 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 9
alexanderMobile is an unknown quantity at this point
Default Re: URL schemes in table cells

Thanks, that's what I was after.

However, when trying it out, I get errors based on the URL:
Code:
UIApplication* theApp = [UIApplication sharedApplication];
[theApp openURL:[NSURL URLWithString:@"mailto:test@example.com"]];
This returns the error
"Unsupported URL
The URL wasn't loaded mailto:test@example.com"
Code:
UIApplication* theApp = [UIApplication sharedApplication];
[theApp openURL:[NSURL URLWithString:@"http://www.google.com"]];
Here, my application minimizes (zooms out), screen goes black, then the simulator shuts down.

Is this normal behavior in the Simulator?
alexanderMobile is offline   Reply With Quote
Old 04-21-2008, 12:44 AM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Location: Onomatopoeia, Lugubriousylvania
Posts: 225
bonehead is an unknown quantity at this point
Default Re: URL schemes in table cells

Yes, that's normal on the simulator. What's happening is that your application is launching an external application using that URL: this causes your application to exit, and the debugger closes. On the simulator there is no handler for the "mailto:" protocol-- thus you get the other error.

Give it a try on an actual device?
bonehead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delayed Table View Load jablair iPhone SDK Development 2 05-13-2009 08:05 PM
Table view aa233 iPhone SDK Development 1 07-10-2008 05:11 PM
Easily customize table cell. pendraggon87 iPhone SDK Development 4 07-04-2008 07:06 AM
Removing Last Table Section jablair iPhone SDK Development 13 06-27-2008 08:32 AM
Changing the table frame in a UITableViewController fasttech iPhone SDK Development 1 05-09-2008 08:36 PM


» Advertisements
» Online Users: 403
18 members and 385 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, iOS.Lover, jarv, LunarMoon, n00b, pbart, Pudding, QuantumDoja, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0