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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:14:37+00:00 2026-05-17T02:14:37+00:00

I am writing an application that needs to interfaces with different backend systems. I

  • 0

I am writing an application that needs to interfaces with different backend systems. I decided to use a Protocol in order to abstract my backend Classes. I created a nib called LoginViewController that contains an “External Object” reference of type “NSObject”, and wired it to the systemDelegate outlet in my LoginViewController.

@interface LoginViewController : UIViewController {

}

@property (nonatomic, retain) IBOutlet UITextField *usernameTextView;
@property (nonatomic, retain) IBOutlet UIImageView *captchaImageView;
@property (nonatomic, retain) IBOutlet UITextField *captchaTextView;
@property (nonatomic, retain) IBOutlet NSObject <BackEndSystemDelegate> *systemDelegate;

- (IBAction) submitCaptcha:(id) sender;
- (IBAction)dismissKeyboard: (id)sender;
- (IBAction) animateViewUp: (id) sender;
- (IBAction) animateViewDown: (id) sender;
- (void) animateViewOnYAxis: (int) offset;
- (void) loadCaptchaImage;

@end

I instanciate the LoginViewController in my application delegate, then try to load the nib with the external object reference. My code calls the loadNibNamed and crashes without a stack trace. I do not reach the NSLog statements after the invocation:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    NSObject <BackEndSystemDelegate> *systemDelegate = [[ACMEBackEndSystemDelegate alloc] init];


    // Init LoginView, and load nib with systemDelegate
    self.viewController = [[LoginViewController alloc] init];
    NSDictionary *proxies = [NSDictionary dictionaryWithObject:systemDelegate forKey:@"systemDelegate"];
    NSDictionary *options = [NSDictionary dictionaryWithObject:proxies forKey:UINibExternalObjects];

    NSArray *toplevelobjects = [[NSBundle mainBundle] loadNibNamed:@"LoginViewController" 
                                                             owner:self.viewController 
                                                           options:options];

    if (toplevelobjects) {
        NSLog(@"toplevelobjects is nil");
    } else {
        NSLog(@"toplevelobjects count %d", [toplevelobjects count]);
    }


    NSLog(@"Controller: %@, View: %@", viewController, viewController.view);

    // Add the view controller's view to the window and display.
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

    return YES;
}

I am at a loss trying to figure this out. Any help would be appreciated.

Thanks,
J Garcia

  • 1 1 Answer
  • 1 View
  • 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-17T02:14:38+00:00Added an answer on May 17, 2026 at 2:14 am

    A few comments:

    • Generally you refer to a delegate object using the pattern id<SomeProtocolName> and not NSObject<SomeProtocolName>

    • You alloc your systemDelegate variable but never release it. This is a memory leak.

    • If the ACMEBackEndSystemDelegate class implements the BackEndSystemDelegate protocol, it is sufficient to allocate it like ACMEBackEndSystemDelegate* systemDelegate = [[ACMEBackEndSystemDelegate alloc] init];

    Now, as for your crash, you said there’s a crash on this line:

    NSArray *toplevelobjects = [[NSBundle mainBundle] loadNibNamed:@"LoginViewController" 
                                                                 owner:self.viewController 
                                                               options:options];
    

    I assume you have a .xib called LoginViewController.xib. Open it up. That is the class type set for “File’s Owner”? Is it LoginViewController? If not, set it. Now check the view outlet property. Is it set to a UIView in the .xib (perhaps a top-level UIView object)? If not, set it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an application that needs to bring window of an external app
I am writing an application that needs to send data over a network. I
I'm writing an application that needs a log-like view, (similar to how an IM
So, I'm writing a Cocoa application that needs to be able to display web
I am writing an application in C# that needs to run as a service
I'm writing a query for an application that needs to list all the products
im writing an application that downloads and installs addons for programs which needs to
I am writing a web application that works with exchange, and so needs to
I am currently writing an application that needs to pull data from an XHTML
I am writing a Facebook application that needs to post on a friend's wall

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.