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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:20:16+00:00 2026-06-03T23:20:16+00:00

Below is a simple PerformSelector that sends a message to obj to perform the

  • 0

Below is a simple PerformSelector that sends a message to obj to perform the looping method. All works well but I get the following yellow warning.

PerformSelector may cause a leak because its selector is unknown.

#import "MyClass.h"
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    @autoreleasepool {
        MyClass *obj = [[MyClass alloc]init];

        SEL mySel = @selector(looping);
        [obj performSelector:mySel];
    }
    return 0;
}

This warning does not make sense because the performSelector must be aware of mySel because the looping method does get called – any ideas whats going on ??


Update

MyClass.h

#import <Foundation/Foundation.h>

@interface MyClass : NSObject

-(void)looping;

@end

MyClass.m

#import "MyClass.h"

@implementation MyClass

-(void)looping{

    NSLog(@"Hey, i'm looping");

}

@end
  • 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-03T23:20:17+00:00Added an answer on June 3, 2026 at 11:20 pm

    Update — The Real Answer

    This is ARC specific:

    performSelector may cause a leak because its selector is unknown

    In short, ARC uses information based on the naming conventions and any additional attributes bound to the selector. When accessing a selector by name and performing it via the performSelector: family of methods, that information is lost and the compiler is warning you that it must make some assumptions regarding reference counting because this information is stripped away.

    In short, the specific program you posted is safe but you are encouraged to use an alternative which is ARC-friendly.

    The Previous Response

    A selector’s declaration does not need to be visible to the current translation in order to call it.

    The compiler is allowed to assume default types for parameters and return types for class and instance methods (id is the default).

    There are several compiler warnings which can warn you of these shady actions.

    You probably forgot to declare the selector looping in the @interface, or you may have omitted the colon, if it has arguments: looping: would be its name.

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

Sidebar

Related Questions

The code below plots some simple x-y data, but it has two problems that
Consider the simple example below of implementing a method in an Enum. One problem
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
below i have a code that runs in most of my simple programs ..
below is my simple code using HTML 5 multiple file upload. All i need
I cant seem to get my session to time out. see below very simple
I have a simple factory below that I would like to simplify and not
I get a seg fault for the simple program below. It seems to be
How can I get the title tag from the s:variant block below using simple
Below are two simple Cython methods I wrote. In g_cython() method I used additional

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.