How to Generate QR Code using Google Api for iPhone/iPad?


Hi,

I have found one very simple way how to generate QR Code using Google Api.Just take 1 UIWebView in my code I have taken IBOutlet UIWebView *webView; and I want add this Much of Information in My QR Code.

1.Business Name

2.First Name and  Last Name

3.Physical Address and phone

4.Website

I have also taken 1 Button Event named here is QRcodeTapped.I am receiving all the Value from NSDictionary.Please check the bellowed methods.

– (IBAction)QRcodeTapped:(id)sender {

NSLog(@”d==%@”,[d valueForKey:@”QR Business Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR First Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Last Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR  Last Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Address”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical City”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical State”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Zip”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Zip Plus 4″]);

NSLog(@”d==%@”,[d valueForKey:@”QR Website”]);

//this url has several parameters which is passed here. After that don’t Forget NSUTF8StringEncoding.

NSString *url=[NSString stringWithFormat:@”http://chart.apis.google.com/chart?cht=qr&chs=200×200&chl=MECARD:ORG%@CN%@%@CTEL%@CADR%@%@%@%@%@CEMAIL%@”,[d valueForKey:@”QR Business Name”],[d valueForKey:@”QR First Name”],[d valueForKey:@”QR Last Name”],[d valueForKey:@”QR Phone”],[d valueForKey:@”QR Physical Address”],[d valueForKey:@”QR Physical City”],[d valueForKey:@”QR Physical State”],[d valueForKey:@”QR Physical Zip”],[d valueForKey:@”QR Physical Zip Plus 4″],[d valueForKey:@”QR Website”]];

url=[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

//Create a URL object.

NSURL *Curl=[NSURL URLWithString:url];

//URL Requst Object

NSURLRequest *request = [NSURLRequest requestWithURL:Curl];

//Load the request in the UIWebView.

[webView loadRequest:request];

}

Grab the Sample Code from Here

Advertisements