I need to embed a QR code reader to my app. So far, ZBarSDK seems to be a good solusion for ios. I have grabbed some examples and tutorials, and embedded the function to my app successfully.
However, For the tutorials I found are all just show the result with an alert.
In my case, the QR code I'm going to use will contain a url, what I need is to present the web directly after scanning. The web needs to be opened in UIweb browser which contains navigation bar so that users can easily go back to the app. I'm a beginner of app development. it would be grateful if anyone can provide some solutions for me. This is my code so far
- (IBAction)scanButtonPress:(id)sender
{
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
[reader.scanner setSymbology:ZBAR_UPCA config:ZBAR_CFG_ENABLE to:0];
reader.readerView.zoom = 1.0;
[self presentModalViewController:reader
animated:YES];
}
- (void) imagePickerController:(UIImagePickerController *)reader didFinishPickingMediaWithInfo:(NSDictionary *)info
{
id <NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for (symbol in results)
{
NSString *upcString = symbol.data;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scanned UPC" message:[NSString stringWithFormat:@"The UPC read was: %@", upcString] delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
[alert show];
[reader dismissModalViewControllerAnimated:YES];
}
}
I know the codes should be changed is there
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scanned UPC" message:[NSString stringWithFormat:@"The UPC read was: %@", upcString] delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
[alert show];
but I do not know what are the correct code for me to reach this function.
Hope this code snippet helps: