Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6873653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:05:45+00:00 2026-05-27T04:05:45+00:00

Current Code Explanation: The iPhone application incorporates the ZBar SDK to scan a bar

  • 0

Current Code Explanation: The iPhone application incorporates the ZBar SDK to scan a bar code. The first bar code is returned and I send symbol.data (the barcode info) to updateTotal. In updateTotal, I check to see if the bar code that was scanned is the one I am looking for (declared as matchBarcode.) In this case, if the bar code is in fact the one I am looking for, it displays an alert with the bar code scanned saying so. If not, it displays an alert saying it is not the correct bar code.

The Problem: No matter what bar code is scanned, it returns that is not equal to matchBarcode string.

My thoughts: I figured it was something to do with barcode (symbol.data) not being an NSString but in the ZBar SDK it states that it is. I’ve been working on this for a while and can’t figure this out. I’m sure it’s a stupid mistake. Please help.

Current code:

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    // ADD: get the decode results
    id<NSFastEnumeration> results =
    [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        // EXAMPLE: just grab the first barcode
        break;

    [self updateTotal:symbol.data];

    NSLog(@"%@", symbol.data);
    // ADD: dismiss the controller (NB dismiss from the *reader*!)
    [reader dismissModalViewControllerAnimated: YES];
}




    -(void)updateTotal:(NSString *)barcode
    {
        // Barcode I am looking for
        NSString *matchBarcode = @"FoundBarcode";
        // Barcode Comparison
        if (barcode == matchBarcode) {
            // Alert stating this IS the barcode you are looking for
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Correct Barcode" message:barcode delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        } else {
            // Alert stating this is not the barcode you are looking for
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Barcode" message:barcode delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:05:46+00:00Added an answer on May 27, 2026 at 4:05 am

    Use isEqualToString method of NSString.

    if( [barcode isEqualToString: matchBarcode]){}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

current code I've built function to do something over collection of jQuery elements: var
My current code looks like the following. How can I pass my array to
My current code to the effect of: if( objectPointer != NULL){ delete objectPointer; }
My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('alex@example.com.au' => 'Alex')) ->setTo(array('alex@example.com.au' =>
My current code needs to read foreign characters from the web, currently my solution
Converting my current code project to TDD, I've noticed something. class Foo { public
Here is the current code I am using: <UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=ButtonPrototype.MainPage Width=640 Height=480>
Here is my current code: RewriteCond %{HTTP_HOST} !^example\.com [NC] #RewriteCond %{REQUEST_URI}!^something RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
I am having a bit of difficulty with this current code I have set
This question is related to a previous question of mine That's my current code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.