NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
[request setHTTPMethod:@"GET"];
NSString *str =[NSString stringWithFormat:@""];
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
NSError *error;
NSData *received = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSDictionary *currencyDic = [NSJSONSerialization JSONObjectWithData:received options:NSJSONReadingMutableContainers error:&error];
I want save json to currencyDic
,but some data couldn't save at key
json:
{
"data": [
{
"USD2JPY": 106.544998,
"USD2SGD_ts": 1465039761,
"USD2ITL_ts": 1434960300,
"USD2FRF": 5.7601,
"USD2GBP": 0.688942,
"USD2MOP_ts": 1464990701,
"USD2CHF": 0.975795,
"USD2AUD_ts": 1465039761,
"USD2EUR_ts": 1465039761,
"USD2EUR": 0.879817,
"USD2CNY_ts": 1465039761,
"USD2HKD_ts": 1465039761,
"USD2CAD_ts": 1465039761,
"USD2ITL": 1700.272217,
"USD2CHF_ts": 1465039761,
"USD2DEM": 1.71745,
"USD2DEM_ts": 1434958500,
"USD2GBP_ts": 1465039761,
"USD2JPY_ts": 1465039761,
"USD2HKD": 7.7678,
"USD2FRF_ts": 1434958260,
"USD2CNY": 6.56645,
"DATA_ts": 1465116640,
"USD2AUD": 1.357589,
"USD2MOP": 8.00155,
"USD2CAD": 1.2938,
"USD2SGD": 1.35655
}
],
"status": "ok"
}
and I use Xcode watch value
currencyDic __NSDictionaryM * 2 key/value pairs 0x00007fc7ac35c110
[0] (null) (no summary) : (no summary)
[1] (null) (no summary) : @"1 element"
key NSTaggedPointerString * 0xd D\x16F\x17\x06\0\0\xa0
value __NSArrayM * @"1 element" 0x00007fc7ac35c0e0
[0] __NSDictionaryM * 27 key/value pairs 0x00007fc7ac35c0b0
[0] (null) (no summary) : (double)0.975795
key NSTaggedPointerString * 0x0 W5E$3\x84d\xa4
value __NSCFNumber * (double)0.975795 0x00007fc7ac330400
[1] (null) @"USD2JPY_ts" : (long)1465039761
[2] (null) @"USD2FRF_ts" : (long)1434958260
key __NSCFString * @"USD2FRF_ts" \xf0\xbf5\xac\xc7\x7f\0\0
value __NSCFNumber * (long)1434958260 0xb0000005587b9b43
........
All strings like "USD2JPY" could not parse,just "no summary",but "USD2SGD_ts" can save into NSDictionary. I try to change option( NSJSONReadingMutableContainers
), NSJSONReadingMutableLeaves
, NSJSONReadingAllowFragments
)It's doesn't work.
How to fix it?Thanks
Xcode uses -debugDescription
of the to print out objects. There are some optimizations in it to prevent the print-out of being too long. What is printed as "(no summary)" are simply strings of the class NSTaggedPointerString
. But they are valid strings.
You should file a bug for this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.