retrieving sqlite3 data for use in a IBaction

Discussion in 'iOS Programming' started by mekopolis, Oct 16, 2008.

  1. mekopolis macrumors regular

    Joined:
    Feb 10, 2008
    #1
    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
     
  2. mekopolis thread starter macrumors regular

    Joined:
    Feb 10, 2008
    #2
    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"]];
    
    
     
  3. mekopolis thread starter macrumors regular

    Joined:
    Feb 10, 2008
    #3
    any thought?...i'm still drawing blanks

    thanks
     
  4. fenrus110 macrumors regular

    Joined:
    Mar 24, 2008
    #4
    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.
     

Share This Page