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

  • Home
  • SEARCH
  • 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 696595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:04:46+00:00 2026-05-14T03:04:46+00:00

In Apple’s The Objective-C Programming Language: Defining a Class the section named Redefining self

  • 0

In Apple’s The Objective-C Programming Language: Defining a Class the section named “Redefining self” recommends that that class methods allocate and return instances use ‘self’ only to allocate an instance and then refer only to that instance. Thus, I have a number of subclasses, that have class methods along the lines of:

+ (id)scrollViewWithFrame: (NSRect)rectFrame
{
    id newInstance = [[[self alloc] initWithFrame:rectFrame] autorelease];
    [newInstance setHasHorizontalScroller: YES];
    [newInstance setHasVerticalScroller: YES];
    [newInstance setBorderType: NSNoBorder];
    [newInstance setAutoresizingMask: (NSViewWidthSizable
                | NSViewHeightSizable)];

    return newInstance;
}

The above is, of course, a subclass of NSScrollView. Unfortunately, with Xcode 3.x all these NSView subclasses now raise warnings: “Warning: Multiple methods named ‘-setAutoresizingMask’ found”. I believe it has something to do with GCC 4.2, which uses the Xcode default settings.

The warning is correct, of course, since NSView and its various subclasses all implement setAutoresizingMask, but it is also unnecessary. Since they’re only warnings, I ignore them but there is a risk that in between the thirty or so unnecessary ones, a really useful warning lurks which I simply don’t see. So, what to do? I do want to adhere to good coding practices and I want to build warning-free apps — how can I do both?

  • 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-14T03:04:47+00:00Added an answer on May 14, 2026 at 3:04 am

    That warning about “multiple methods found” means that more than one class implements setAutoresizingMask: and the compiler can’t tell which one this is because the variable is typed id. The compiler is warning you that it’s possible (since the class of the object is unknown) that you might get the wrong one. Try typing newInstance either as an NSScrollView* or as your class and the warning will go away. You can still return id, since it’s equivalent to all object-pointer types. It’s just the variable you’re sending messages to that the compiler wants to be statically typed.

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

Sidebar

Related Questions

Apple states that if you want to report a GKAchievement but you get a
Apple changed their home page with a fade in effect that loads fast. Is
Apple's guidelines for their new Mac App Store say that you cannot use deprecated
Apple deprecated Java and will stop supporting it in the future. Assuming that Oracle
Apple suggests that prior to submitting to the Mac application store, the installation process
Apple recommends cropping out the status bar from screenshots submitted to the app store.
Apple sometimes uses the Bitwise-Shift operator in their enum definitions. For example, in the
Apple has deprecated their JVM and it may not be supported in future versions
Apple is the backing force of ObjectiveC. However WebKit is written in C++. Apart
Apple describes iOS SDK 4 contains over 1,500 new APIs. Such as 1.Calendar Access

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.