• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How is an NSDecimalNumber an incompatible type for argument 1 of 'decimalNumberWithDecimal:'?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How is an NSDecimalNumber an incompatible type for argument 1 of 'decimalNumberWithDecimal:'?


  • Subject: How is an NSDecimalNumber an incompatible type for argument 1 of 'decimalNumberWithDecimal:'?
  • From: Michael Swan <email@hidden>
  • Date: Fri, 20 Jun 2008 16:26:09 -0400

Perhaps someone else has seen this before but it makes no sense to me. The included code is from a NSManagedObject subclass and is part of a method to return a readonly property that is based on the value of two attributes (amount & frequency).
With the this code: (I removed irrelevant code to save space)


- (NSDecimalNumber *)monthly
{
	NSDecimalNumber * tmpValueA;
    	[self willAccessValueForKey:@"amount"];
    	tmpValueA = [self primitiveAmount];
   	[self didAccessValueForKey:@"amount"];
	...
	NSDecimalNumber * tmpValueC;
	...
	switch ([tmpValueB intValue])
	{
		...
		case 2:
			tmpValueC = [NSDecimalNumber decimalNumberWithDecimal:tmpValueA];
			break;
		...
	}
	return tmpValueC;
}

I get this error:
error: incompatible type for argument 1 of 'decimalNumberWithDecimal:'

The documentation says that decimalNumberWithDecimal: takes an NSDecimalNumber as its argument and tmpValueA is an NSDecimalNumber unless I am missing something.
I guess I could pull the decimal number out of the NSDecimalNumber and dump it into a string and then use decimalNumberWithString: but that seems really inefficient.
If anyone has any ideas as to what I am doing wrong please let me know.


Thank You,
Mike Swan
ETCP Certified Entertainment Electrician







"Every experience in your life is an opportunity to learn something new and to make a change for your ultimate benefit."



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How is an NSDecimalNumber an incompatible type for argument 1 of 'decimalNumberWithDecimal:'?
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: hitTest question
  • Next by Date: Re: PDFKit guidance
  • Previous by thread: Contract Job for Cocoa Developer in Simi Valley CA
  • Next by thread: Re: How is an NSDecimalNumber an incompatible type for argument 1 of 'decimalNumberWithDecimal:'?
  • Index(es):
    • Date
    • Thread