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

mekopolis

macrumors regular
Original poster
Feb 10, 2008
152
0
i was wondering if someone could help me out with this, its probably really simple yet its stumping me

what i want to do is take a value out of a sqlite database...
in this case 4, and apply them to a button command execution which will take those values, and feed them into this command

here is my code

Code:
-(IBAction)openMaps {
	// Where is Apple on the map anyway?
	NSString* addressText = @"1 Infinite Loop, Cupertino, CA 95014";
	// URL encode the spaces
	addressText =  [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];	
	NSString* urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
	// lets throw this text on the log so we can view the url in the event we have an issue
	NSLog(urlText);
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

does that make sense?
basically instead of having a fixed set of data in
NSString* addressText = @"1 Infinite Loop, Cupertino, CA 95014";
i want the variables extracted from the sqlite3 database

do i just set them in? like

NSString* addressText = @"Address, Town, State, Zip";
or do i have to change some characters around

thanks so much
 

mekopolis

macrumors regular
Original poster
Feb 10, 2008
152
0
also i would like to do the same with a phone #

like this

Code:
-(IBAction)openPhone {
	// Call Google 411
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];

is it

Code:
-(IBAction)openPhone {
	// Call Google 411
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://Phone1"]];
 

fenrus110

macrumors regular
Mar 24, 2008
142
0
Why don't you just extract them as chars, put them into strings (like in the sample code) then treat them as a regular strings?

there are other threads on this forum about how to make phone calls, check them.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.