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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:07:13+00:00 2026-06-07T01:07:13+00:00

I have a class to perform little conversions like NSDate to NSString with a

  • 0

I have a class to perform little conversions like NSDate to NSString with a specific format, etc.

Every methods are class methods, eg +[Tools humanReadableStringForDate:(NSDate*)date];

I sometime need my method +[Tools A] to call a method +[Tools B] of my class, but inside a block.

Should I create a __block safeSelf = self; or is it unnecessary because I use class level methods ?

EDIT :
here is an example, not my actual code :

@implementation FileManager 

+(void) uploadEveryFile:(void (^)(NSObject*))thingToDo :(NSArray*) fileArray {

    for(NSString *s in fileArray) {
        [[SomeWebAPI uploadFile:s withSuccess:^(NSNumber *responseCode) {
            [self logUploadOk:s];
        }];
    }
}

+(void) logUploadOk:(NSString*)s {
    NSLog(@"File upload ok : %@", s)
}

@end

I think this make things clearer. I like to use self keyword even for class methods when I can – in this example I can because I am in the same class and refer to a class level method – because it seems to make more sense, and can be helpful if I have to modify my class name.

So is it correct to write it like this ? Is it working but not really correct ? Do I really need to call logUploadOk using [FileManager logUploadOk:s] ?

Thank you !

  • 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-07T01:07:15+00:00Added an answer on June 7, 2026 at 1:07 am

    It is unnecessary to use __block or __weak or anything like that. You are talking about self in a class method, which is the class object itself. The class object lives for the whole program, so memory management like retain and release on it have no effect. So you don’t need to worry about retain cycles.

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

Sidebar

Related Questions

I have write a little class to perform the download of the images by
I have various class which perform save and update operations of GUI elements, it
I have a class that I need to perform some actions on but I
lets say i have a background worker in a class that perform db query
I have class grades that I need to check if a specific grade is
I have a class with a collection member. I would like to prevent external
I have a little problem in object programming in javascript There is a class
I have Class and Student objects. Both have collection of another as property. Which
I have class LegacyClass which inherits OldBaseClass. I'm considering a change to introduce a
I have class that extend FragmentActivity in it I add fragment to layout as

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.