• 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
Re: NSDictionary error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary error


  • Subject: Re: NSDictionary error
  • From: Alan Hart <email@hidden>
  • Date: Fri, 14 Apr 2006 15:26:20 +0100


On 14 Apr 2006, at 14:04, Jerrod Fowkes wrote:
I am going to see if the object at Key ksWSMethodInvocation* is a dictionary and see if I can get some key value pairs out of there. If I have troubles I will hollar.

Here is what I have found before I got your responses. I messed around some more and did this:

NSString* value;
value = [result objectForKey: (NSString*)kWSMethodInvocationResult];
NSString* value1;
value1 = [[NSString alloc] initWithFormat : @"%@", value];

OK, I wasn't familiar with the WebServices API so I looked up kWSMethodInvocationResult. As far as I can see, assuming result is the NSDictionary* that is produced by WSMethodInvocationInvoke(), then value already contains the string you want. It's not a dictionary, so ignore my previous suggestion.


So, I would like to know this:

How come the description for the object that I am getting out of key KWSMethodInvocationResult is the actual value that I am looking for.

Why *shouldn't* [result objectForKey:KWSMethodInvocationResult] be the value you're looking for? Why are you trying to process it further if it's already the string you want?


1)Is there some kind of default there that I don't know about ?!

No.

2)How come initWithFormat appears to copy the contents of the object out as a string and initWithString doesn't..

I'm guessing it's because the items in the CFDictionary returned by WSMethodInvocationInvoke() are not Cocoa objects, they are CoreFoundation structures, and you have to cast the objectForKey: to an NSString before you can use it to initWithString. If so your original code:


value = [[NSString alloc] initWithString: [result objectForKey: (NSString*) kWSMethodInvocationResult]];

.... should have contained an extra cast:

value = [[NSString alloc] initWithString: (NSString*)[result objectForKey: (NSString*) kWSMethodInvocationResult]];

I'm not sure what you mean by "... I cast initWithString as a NSString". You can't, and didn't, cast the method as a string.

-- Alan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSDictionary error
      • From: Jerrod Fowkes <email@hidden>
References: 
 >Re: NSDictionary error (From: Jerrod Fowkes <email@hidden>)

  • Prev by Date: Talented Cocoa Developer Wanted
  • Next by Date: Re: NSDictionary error
  • Previous by thread: Re: NSDictionary error
  • Next by thread: Re: NSDictionary error
  • Index(es):
    • Date
    • Thread