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 6914547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:21:42+00:00 2026-05-27T09:21:42+00:00

I am developping an App using XCode 4.2 that detects a QR code. I

  • 0

I am developping an App using XCode 4.2 that detects a QR code.

I am trying to make a switch view after QR code detection but it is not working at all

here is the code am using :

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{

     AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);


    // ADD: get the decode results
    id<NSFastEnumeration> results =
    [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;   
    for(symbol in results)
        break;


    NSString *string=symbol.data;
    NSString *string2=@"1234";

    if ([string isEqualToString:string2]) {

//this is the part that is not working : it doesn t load the AboutView at all

        AboutView *about = [[AboutView alloc] initWithNibName:nil bundle:nil];
        [self presentModalViewController:about animated:YES];
    }

    else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                                        message:@"This is not a recognized QR code!" 
                                                       delegate:self 
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles:nil];
        [alert show];

    }

    // ADD: dismiss the controller (NB dismiss from the *reader*!)
    [reader dismissModalViewControllerAnimated: YES];
}

thanks

  • 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-27T09:21:42+00:00Added an answer on May 27, 2026 at 9:21 am

    The issue is that the reader is the presented view controller in zbar’s example code

    -(void)presentReaderInViewController:(UIViewController*)vc
    

    and you are treating self as if it is presented

    You should use reader to present your AboutView and only dismiss reader in the else block

    if ([string isEqualToString:string2]) {
    
    //this is the part that is not working : it doesn t load the AboutView at all
    
            AboutView *about = [[AboutView alloc] initWithNibName:nil bundle:nil];
            [reader presentModalViewController:about animated:YES];
        }
    
        else{
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                                                            message:@"This is not a recognized QR code!" 
                                                           delegate:self 
                                                  cancelButtonTitle:@"OK" 
                                                  otherButtonTitles:nil];
            [alert show];
            // ADD: dismiss the controller (NB dismiss from the *reader*!)
        [reader dismissModalViewControllerAnimated: YES];
        }
    

    You might also want to wait to dismiss reader in the delegate method of your alert view (create a soft reference and dismiss that… myReader = reader; when you set up the alertview)

    - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
        [myReader dismissModalViewControllerAnimated: YES];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developping an iPhone App that sends SMS, I am using XCode 4.2
Using the Settings.app on the iPhone isn't that hard. In fact Xcode does the
I'm trying to debug in XCode using the instruments but most of them are
I'm developping an app that creates an Excel spreadsheet. I'm using Java with docx4j
I am developing a web app (using rails) that I will be launching within
I'm developing a web app and currently using sql server 2008 for it. But,
I am developing an iPhone app and are using xCode to do Build and
I'm currently developping a database browsing app using Qt & C++. The databases are
I'm currently developping an iPad app which is using OpenGL to draw some very
I'm currently developing an app using ASP.NET MVC3 and Entity Framework 4.1 Code First

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.