Note that there are some explanatory texts on larger screens.

plurals
  1. POcan't fetch object from nsdictionary...?
    primarykey
    data
    text
    <p>I've done this thing lots and lots of time. But I don't know why I can't figure out what is the issue with this object when I try to fetch it from NSDictionary.</p> <p>I've NSMutableArray object which have below data.</p> <blockquote> <p>( { SelectUserDataResult = "[{ 'UserID': '3D5CC4E6-25E8-4591-A84A-6BD7D020DB17', 'ClientID': '895D7BE5-B5D0-48AE-8AAB-6863FCD1D5BF', 'TimeZoneCulture_Term': 'en-US', 'Currency_Term': 'GBP', 'LoginLogID': 'c76960b1-aa24-454f-9fe7-f4f3960fefd4' }]"; } )</p> </blockquote> <p>Now I fetch my first object like</p> <pre><code>NSDictionary *dicResponse = [[[NSDictionary alloc]initWithDictionary:(NSDictionary *)[data objectAtIndex:0]] objectForKey:@"SelectUserDataResult"]; NSLog(@"%@",dicResponse); </code></pre> <blockquote> <p>[{ 'UserID': '3D5CC4E6-25E8-4591-A84A-6BD7D020DB17', 'ClientID': '895D7BE5-B5D0-48AE-8AAB-6863FCD1D5BF', 'TimeZoneCulture_Term': 'en-US', 'Currency_Term': 'GBP', 'LoginLogID': 'c76960b1-aa24-454f-9fe7-f4f3960fefd4' }]</p> </blockquote> <p>Now, from above I want fetch <strong>UserID</strong> and other things so, I just code like</p> <pre><code>NSString *abc = [dicResponse objectForKey:@"UserID"]; </code></pre> <p>but it gives me error like </p> <blockquote> <p>-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7a70200</p> </blockquote> <p>Can't find where I'm wrong.</p> <p>Thanks</p> <p>========= Part-2</p> <p>I just mange to change my NSMutableArray object data as below</p> <blockquote> <p>( "[{ 'UserID': '3D5CC4E6-25E8-4591-A84A-6BD7D020DB17', 'ClientID': '895D7BE5-B5D0-48AE-8AAB-6863FCD1D5BF', 'TimeZoneCulture_Term': 'en-US', 'Currency_Term': 'GBP', 'LoginLogID': 'c76960b1-aa24-454f-9fe7-f4f3960fefd4' }]" )</p> </blockquote> <pre><code>NSDictionary *dicResponse = (NSDictionary *)[data objectAtIndex:0]; </code></pre> <p>gives me the same thing as last.</p> <p>how to remove " as mikeweller suggest.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload