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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:01:05+00:00 2026-06-02T18:01:05+00:00

Based on my reading around, I have learned that I need to set a

  • 0

Based on my reading around, I have learned that I need to set a variable in my AppDelegate that references my view controller so that I can do things like this. Receive a barcode scan and subsequently call a method in a controller and pass in that barcode scan. So I have this in my AppDelegate.

- (void)BarcodeDataArrived:(char *)BarcodeData;
{
[myViewController LoadBarcodePage:BarcodeData];
}

I know that this method is being called when my bluetooth scanner scans a barcode. The problem is that myViewController object is not referencing the current view controller and as a result all the objects are null.

I don’t think I want to create a new instance of myViewController since the storyboard is already creating an instance of it when the app loads. I just want to be able to reference the same object that the storyboard is creating. So, if I am understanding things correctly, I need to do something like this in my AppDelegate to set the variable:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:  (NSDictionary *)launchOptions
{

    // I Want To Set A Reference To My View Controller Here Such As...   

    myViewController = aViewController;

    // Where aViewController Is What The Storyboard Initialized.

    return YES;
}

How would I do this. All the references I have found on the NET seem to involve nibs and not storyboards.

This is my first app. Help please!

  • 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-06-02T18:01:06+00:00Added an answer on June 2, 2026 at 6:01 pm

    You shouldn’t implement that in your App Delegate.
    Why don’t you try to implement your BarcodeDataArrived in a ViewController then

    - (void)BarcodeDataArrived:(char *)BarcodeData {
       [self performSegueWithIdentifier:@"toMyViewControllerSegue" 
                                 sender:self];
    
        }
    

    Then in the prepareForSegueMethod you can send data to the destination Controller

     -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
     myViewController *destinationController= (myViewController * )segue.destinationViewController;
    
        destinationController.BarcodeData=BarcodeData;
    
      }
    

    Now if you don’t want to change the view then you have to try another approach, myViewController should be an object ( or class) and implement the method LoadBarcodePage in there. You could have the object in the delegate and it can be referenced in any class by using

     AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     [delegate.myVar doWhatever you want];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been reading that M3G is something based on OpenGL ES...so can I work
I have been doing some reading, and I see that I can use getch()
Based on my reading and testing, with asynchronous sockets, the socket itself can be
I have question that comes from a algorithms book I'm reading and I am
Based on reading around the web, stack overflow, and mostly these articles about db
I'm having several issues based around reading and writing an NSArray to and from
There are some HTML based games (ie bootleggers.us) that have a simple login form
I've been reading some posts here and articles around the web but I can't
I've been reading this post Creating a login form in CodeIgniter based on Ion
I've spent many many hours tonight reading up on implementing the event-based asynchronous pattern

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.