嗨,我已经实现了用于解析以下响应的代码,但它无法正常工作:
NSString *req = [NSString stringWithFormat: @" My URL"];
NSDictionary *googleResponse = [[NSString stringWithContentsOfURL: [NSURL URLWithString: req] encoding: NSUTF8StringEncoding error: NULL] JSONValue];
NSDictionary *resultsDict = [googleResponse valueForKey: @"eventtitle"];
解析以下响应的代码是什么?请给我解决方案。
{
"AlansHarleyEvents": [
{
"id": "3",
"eventtitle": "22nd Annual Pig Roast",
"eventdate": "April 22nd 8am-5pm"
},
{
"id": "4",
"eventtitle": "Poker Run",
"eventdate": "April 28th 8am at Shooters"
},
{
"id": "5",
"eventtitle": "Kickstands for kids",
"eventdate": "May 12th 8am-5pm"
},
{
"id": "6",
"eventtitle": "Ride for the Cure",
"eventdate": "May28th 8am Free Drinks!"
},
{
"id": "7",
"eventtitle": "Veterans Ride",
"eventdate": "June 10th 9am @City Hall"
},
{
"id": "8",
"eventtitle": "Biker Beach Bash",
"eventdate": "June 28th 8-5pm @ The Pier"
},
{
"id": "10",
"eventtitle": "22nd Annual Pig Roast",
"eventdate": "April 22nd 8am-5pm"
},
{
"id": "11",
"eventtitle": "Poker Run",
"eventdate": "April 28th 8am at Shooters Lounge"
},
{
"id": "12",
"eventtitle": "22nd Annual Pig Roast",
"eventdate": "April 22nd 8am-5pm"
},
{
"id": "13",
"eventtitle": "Swamp Run",
"eventdate": "April 22nd 8am-5pm"
}
]
}