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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:38:08+00:00 2026-05-29T19:38:08+00:00

I have done I custom class method for NSString to md5 a NSString. This

  • 0

I have done I custom class method for NSString to md5 a NSString.
This is my code:

NSString+CustomMethod.h

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>


@interface NSString (CustomMethod)

+ (NSString*)MD5:(NSString *)string;
@end

NSString+CustomMethod.m

#import "NSString+CustomMethod.h"

@implementation NSString (CustomMethod)

+ (NSString*)MD5:(NSString *)string
{
    // Create pointer to the string as UTF8
    const char *ptr = [string UTF8String];

    // Create byte array of unsigned chars
    unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];

    // Create 16 byte MD5 hash value, store in buffer
    CC_MD5(ptr, strlen(ptr), md5Buffer);

    // Convert MD5 value in the buffer to NSString of hex values
    NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
    for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) 
        [output appendFormat:@"%02x",md5Buffer[i]];

    return output;
}


@end

This Methodclass works great, but compiler give me a warring:

warning: class method ‘+MD5:’ not found (return type defaults to ‘id’) [3]

How can I remove this warning ??

PS: if a put #import “NSString+CustomMethod.h” no warning is shown, but it’s a workAround, I have created a custom method class not to include my custom class everywhere I need it

Thanks for any helps !!

  • 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-29T19:38:09+00:00Added an answer on May 29, 2026 at 7:38 pm

    Put #import "NSString+CustomMethod.h" in .pch file or in file where you want to use it.

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

Sidebar

Related Questions

I have a custom UIView subclass without a corresponding UIViewController. I use this class
I have a custom exception class with a show() method that shows exceptions in
I have a custom class MyFutureTask extends FutureTask<Void> upon which I do some code
I have a custom logging class for my Python script with a flush() method
I have done a bit of testing on this myself (During the server side
I have done a bit of research into this and it seems that the
I have done this: $ z() { echo 'hello world'; } How do I
I have done the following code in JavaScript to put focus on the particular
So, I have a list containing a custom class, MyClass MyClass has properties, which
First of all this is all just concept, I have no actual programming done

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.