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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:36:07+00:00 2026-05-15T05:36:07+00:00

I’ve found a bunch of posts on this problem and have actually managed to

  • 0

I’ve found a bunch of posts on this problem and have actually managed to removed one of the warnings i was getting from these however one persists.

Some context: I’m creating currency converter as an exercise in learning Objective C

My Rate class represents a rate that a currency can be converted to or from looks like this:

Rate.h

//
//  Rate.h
//  Currency Converter
//
//  Created by Matthew Spence on 08/06/2010.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface Rate : NSObject {
NSString* code;
NSString* description;
float rate;
}
- (id)init;
- (id)initTest;
- (id)initWithCode:(NSString*)code description:(NSString*)description  rate:(float)rate;
@property(retain) NSString* code;
@property(retain) NSString* description;
@property(readwrite) float rate;
@end

Rate.m

//
//  Rate.m
//  Currency Converter
//
//  Created by Matthew Spence on 08/06/2010.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "Rate.h"


@implementation Rate
@synthesize code;
@synthesize description;
@synthesize rate;
- (id)init {
return self;
}

- (id)initTest {
return self;
}

- (id)initWithCode:(NSString*)codeA description:(NSString*)descriptionA  rate:(float)rateA {
self.code = codeA;
self.description = descriptionA;
self.rate = rateA;
[self init];
return self;
}
@end

The warning is occurring here in ExchangeRates a singleton class that holds a matrix of rates:

ExchangeRates.m

//
//  ExchangeRates.m
//  Currency Converter
//
//  Created by Matthew Spence on 02/06/2010.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ExchangeRates.h"
#import "SynthesizeSingleton.h"
#import "Rate.h"
#import "NSString+CVS.h"


@implementation ExchangeRates
@synthesize matrix;
synthesize_singleton(ExchangeRates);
- (id)init {

self = [super init];
self.matrix = [NSMapTable init];
    if (self) {
    NSError *error = nil;
    NSString *matrixString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://rss.timegenie.com/forex.txt"] encoding:NSUTF8StringEncoding error:&error];
    NSArray *matrixArray = [matrixString csvRows];
    for(NSArray *rateArray in matrixArray) {
        Rate *rate = [Rate initWithCode:[rateArray objectAtIndex:0] description:[rateArray objectAtIndex:1] rate:[rateArray objectAtIndex:2]];
        [self.matrix setObject:rate forKey:[rateArray objectAtIndex:0]] ;
        NSLog(@"my ns string = %@", [rateArray objectAtIndex:0]);
    }
    }

    return self;
}
@end

On the line:

Rate *rate = [Rate initWithCode...

Warning:

'Rate' may not respond to '+initWithCode:description:rate:'

As I understand it its normally due the method not being declared in the header or the header not being imported, but as you can see I’ve done 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-15T05:36:08+00:00Added an answer on May 15, 2026 at 5:36 am

    You should initialize an ObjC instance as

    Rate* rate = [[Rate alloc] initWithCode:...];
    //                  ^^^^^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.