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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:26:06+00:00 2026-05-19T03:26:06+00:00

for the last couple of weeks I’ve finally gotten into Obj-C from regular C

  • 0

for the last couple of weeks I’ve finally gotten into Obj-C from regular C and have started my first app. I’ve watched tutorials and read through a book along with a lot of webpages, but I know I’ve only just begun. Anyway, for most of the night and this morning, I’ve been trying to get this code to work, and now that it will compile, I have a few warnings. I’ve searched and found similar problems with solutions, but still no dice. What I’m trying to do is put an array made from a txt document into the popup list in a combo box.

AwesomeBoxList.h:

    #import <Cocoa/Cocoa.h>
@interface AwesomeBoxList : NSObject 
{
  IBOutlet NSComboBox *ComboBoz;
}
-(NSArray *) getStringzFromTxtz;
- (void) awesomeBoxList;
@end

AwesomeBoxList.m:

#import "AwesomeBoxList.h"

@implementation AwesomeBoxList

-(NSArray *)getStringzFromTxtz 
{
...
return combind;
}

- (void) awesomeBoxList
{
 [ComboBoz setUsesDataSource:YES];


 [ComboBoz setDataSource:

[ComboBoz getStringzFromTxtz]: //'NSComboBox' may not respond to 'getStringzFromTxtz'

[ComboBoz comboBox:(NSComboBox *)ComboBoz objectValueForItemAtIndex: 

 [ComboBoz numberOfItemsInComboBox:(NSComboBox *)ComboBoz]]];


        /*'NSComboBox' may not respond to '-numberOfItemsInComboBox:'
   'NSComboBox' may not respond to '-comboBox:objectValueForItemAtIndex:'
   'NSComboBox' may not respond to '-setDataSource:'
  */
 }

@end

So, with all of these errors and my still shallow knowledge of Obj-C, I must be making some sort of n00b mistake.

Thanks for the help.

  • 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-19T03:26:06+00:00Added an answer on May 19, 2026 at 3:26 am

    There does seem to be a generally large amount of confusion here, mostly manifested in your last
    (4) line(s) of code. You are aware that the ‘:’ symbol is used to pass arguments to methods, not terminate a line? You are essentially daisy chaining those last 4 lines together in a way that makes no sense. As for the specific warnings, getStringzFromTxtz is a method you defined on AwesomeBoxList, not a method of NSComboBox. numberOfItemsInComboBox: and comboBox:objectValueForItemAtIndex: are NSComboBoxDataSource Protocol methods, intended to be implemented by your class on behalf of an NSComboBox, not NSComboBox methods. I would recommend doing a bit of reading on Delegates and Protocols.

    To elaborate:
    In order for your AwesomeBoxList class to use an NSComboBox, it needs to provide information to the combo box that the combo box needs to know. In the Apple Universe, situations like this are typically handled with the Delegate Design Pattern. Specifically, the combo box needs to know how many items it will be showing as well as the object representation for each of the shown items. The combo box declares the interface for doing this in the NSComboBoxDataSource Protocol. By providing this info, you are acting as the datasource for the combo box. You can tell the combo box that it should defer to your class for its data by setting yourself as its dataSource property in Interface Builder or with a call to

    [ComboBoz setDataSource:self];
    

    from somewhere in your AwesomeBoxList’s implementation. That will ensure that the combo box calls methods in your class to populate itself with info. There are two methods specifically that your AwesomeBoxList class should implement, and which will be called by the combo box:

    - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index {
        switch (index) {
            // Return some object that is represented by index in the combo box
        }
    }
    
    - (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox {
        // return theNumberOfItemsInYourComboBox;
    }
    

    Providing a meaningful implementation is all you need to do to populate your combo box with data. I don’t know the specifics of what you want here, but that is the pattern you want to follow. Hope that helps a bit more.

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

Sidebar

Related Questions

i have been getting into rails over the course of the last couple weeks
I've been working the last couple of weeks on a image downloader from the
For the last couple months i have ben having some issues with my app.config
I have been studding GIT for the last couple of weeks in an attempt
I've been working with the Restlet library for the last couple weeks and from
Over the last couple of weeks i have come across lots of articles about
Well from last couple of weeks I am developing an application using html, javascript
Over the last couple of weeks I have asked a couple of questions on
I have passed the last couple of hours trying to downgrade Java to 1.6.0_13
I have spent the last couple of days to use Core Plot for the

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.