how is the code for parsing Json parsing? - iphone

Hi I have implemented code for parsing the below response as follows but it is not working properly:
NSString *req = [NSString stringWithFormat: #" My URL"];
NSDictionary *googleResponse = [[NSString stringWithContentsOfURL: [NSURL URLWithString: req] encoding: NSUTF8StringEncoding error: NULL] JSONValue];
NSDictionary *resultsDict = [googleResponse valueForKey: #"eventtitle"];
What is the code for parsing the below response? Please give me solution.
{
"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"
}
]
}

If your resultsDict contains the above JSON response then you can parse it as :
NSString *req = [NSString stringWithFormat: #" My URL"];
NSDictionary *googleResponse = [[NSString stringWithContentsOfURL: [NSURL URLWithString: req] encoding: NSUTF8StringEncoding error: NULL] JSONValue];
NSDictionary *resultsDict = [googleResponse valueForKey: #"eventtitle"];
NSMutableArray *resultArray = [resultsDict valueForKey:#"AlansHarleyEvents"];
for(int i = 0; i<[resultArray count]; i++)
{
NSLog(#"%#",[[resultArray objectAtIndex:i] valueForKey:#"id"]) ;
NSLog(#"%#",[[resultArray objectAtIndex:i] valueForKey:#"eventtitle"]) ;
NSLog(#"%#",[[resultArray objectAtIndex:i] valueForKey:#"eventdate"]) ;
}

NSJSONSerialization Class is the Native Class for only iOS 5 and above
http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
For any iPhone OS version means you can go for JSONKit:
https://github.com/johnezang/JSONKit

Yu can use NSJSONSerialization object with IOS 5
NSDictionnary *jsonObject = [NSJSONSerialization JSONObjectWithData:resultsDict options:NSJSONReadingMutableContainers error:&error];

Related

Retrieving and displaying JSON data from URL (objective-C)

I am doing my homework to retrieve and display information about current weather from a JSON object using singleton pattern and ASIHTTPRequest.
The data from the URL in JSON format looks like this:
{ "data":
{ "current_condition":
[ {
"cloudcover": "51",
"humidity": "66",
"observation_time": "12:44 PM",
"precipMM": "0.0",
"pressure": "1002",
"temp_C": "30",
"temp_F": "86",
"visibility": "10",
"weatherCode": "116",
"weatherDesc": [ {"value": "Partly Cloudy" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0004_black_low_cloud.png" } ],
"winddir16Point": "S",
"winddirDegree": "170",
"windspeedKmph": "19",
"windspeedMiles": "12" } ],
"request": [ {
"query": "Lat 22.49 and Lon 114.14",
"type": "LatLon" } ],
"weather": [ {
"date": "2012-06-06",
"precipMM": "0.0",
"tempMaxC": "30",
"tempMaxF": "86",
"tempMinC": "26",
"tempMinF": "79",
"weatherCode": "113",
"weatherDesc": [ {"value": "Sunny" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png" } ],
"winddir16Point": "SE",
"winddirDegree": "136",
"winddirection": "SE",
"windspeedKmph": "17",
"windspeedMiles": "11"
},
{
"date": "2012-06-07",
"precipMM": "0.1",
"tempMaxC": "30",
"tempMaxF": "87",
"tempMinC": "27",
"tempMinF": "80",
"weatherCode": "113",
"weatherDesc": [ {"value": "Sunny" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png" } ],
"winddir16Point": "ESE",
"winddirDegree": "121",
"winddirection": "ESE",
"windspeedKmph": "15",
"windspeedMiles": "10"
},
{
"date": "2012-06-08",
"precipMM": "2.1",
"tempMaxC": "31",
"tempMaxF": "87",
"tempMinC": "27",
"tempMinF": "81",
"weatherCode": "116",
"weatherDesc": [ {"value": "Partly Cloudy" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png" } ],
"winddir16Point": "SSE",
"winddirDegree": "166",
"winddirection": "SSE",
"windspeedKmph": "17",
"windspeedMiles": "11"
},
{
"date": "2012-06-09",
"precipMM": "2.8",
"tempMaxC": "32",
"tempMaxF": "89",
"tempMinC": "28",
"tempMinF": "82",
"weatherCode": "176",
"weatherDesc": [ {"value": "Patchy rain nearby" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0009_light_rain_showers.png" } ],
"winddir16Point": "SSW",
"winddirDegree": "198",
"winddirection": "SSW",
"windspeedKmph": "17",
"windspeedMiles": "11"
},
{
"date": "2012-06-10",
"precipMM": "13.0",
"tempMaxC": "32",
"tempMaxF": "90",
"tempMinC": "28",
"tempMinF": "82",
"weatherCode": "116",
"weatherDesc": [ {"value": "Partly Cloudy" } ],
"weatherIconUrl": [ {"value": "http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png" } ],
"winddir16Point": "SW",
"winddirDegree": "220",
"winddirection": "SW",
"windspeedKmph": "22",
"windspeedMiles": "14"
} ]
}
}
In my AppData.m, the code looks like this:
- (void)requestFinished:(ASIHTTPRequest *)request {
NSData* responseData = [request responseData];
NSDictionary* resultDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:NULL];
NSDictionary* dataDict = [resultDict objectForKey:#"data"];
NSArray* myArray = [dataDict objectForKey:#"weather"];
if(weatherDataArray == nil)
weatherDataArray = [[NSMutableArray alloc] init];
[weatherDataArray setArray:myArray];
}
In myWeather.m, the code like this :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
myWeatherDataCell *cell = [tableView dequeueReusableCellWithIdentifier:#"myWeatherDataCell"];
// get the view controller's info dictionary based on the indexPath's row
NSDictionary* item = [[AppData sharedData].weatherDataArray objectAtIndex:indexPath.row];
cell.maxTempLabel.text = [item objectForKey:#"tempMaxC"];
cell.minTempLabel.text = [item objectForKey:#"tempMinC"];
cell.dateLabel.text = [item objectForKey:#"date"];
cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
NSArray* weatherIconUrl = [item objectForKey:#"weatherIconUrl"];
NSDictionary* value = [weatherIconUrl valueForKey:#"value"];
NSString* urlString = [NSString stringWithFormat:#"%#",value];
NSData* url = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:urlString]];
cell.iconView.image = [UIImage imageWithData:url];
NSLog(#"weatherIconUrl" "%#",urlString);
return cell;
}
The tableview can show
cell.maxTempLabel.text = [item objectForKey:#"tempMaxC"];
cell.minTempLabel.text = [item objectForKey:#"tempMinC"];
cell.dateLabel.text = [item objectForKey:#"date"];
Except the iconview.image.
I try to use NSlog for
NSString* urlString = [NSString stringWithFormat:#"%#",value];
It can show looks like this:
2012-11-11 11:51:46.100 MyWeather[1583:1a603] weatherIconUrl(
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
)
2012-11-11 11:51:46.101 MyWeather[1583:1a603] weatherIconUrl(
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0017_cloudy_with_light_rain.png"
)
2012-11-11 11:51:46.102 MyWeather[1583:1a603] weatherIconUrl(
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
)
2012-11-11 11:51:46.102 MyWeather[1583:1a603] weatherIconUrl(
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
)
2012-11-11 11:51:46.103 MyWeather[1583:1a603] weatherIconUrl(
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png"
)
But when I try to NSLog NSData* url, the result is (null).
So I think I am stuck in when "NSString* urlString" pass the data to "NSData* url".
As I said in my comment, your variable, "weatheIconURL", is actually an array with one object (a dictionary) in it, so you can use lastObject to fix that line. So those few lines need to be changed to:
NSDictionary* weatherIconUrl = [[item objectForKey:#"weatherIconUrl"] lastObject];
NSString* urlString = [weatherIconUrl valueForKey:#"value"];
NSData* url = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:urlString]];
cell.iconView.image = [UIImage imageWithData:url];
you can use JsonKit
to parse Jdon data and convert it into dictionary after getting the response from ASSIHTTPRequest
like this
- (void) requestFinished:(ASIHTTPRequest *)request {
// Use when fetching text data
NSString *responseString = [request responseString];
// Json dictionary
NSDictionary *resultsDictionary = [responseString objectFromJSONString];
}
in your case if you wanna get the cloudcover you may say
NSString *cloudCover =[[[resultsDictionary objectForKey:#"data"]objectForKey:#"current_condition"] objectAtIndex:0];
hope that helps

how to json parse with components Separated By String

im new to parsing JSON and im trying a simple task, to retrieve a URL from a forecast weather json file.
Here i parse the json and i NSLog the contents of each component of the data:
NSError *myError = nil;
NSDictionary *res = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&myError];
NSArray *data = [res objectForKey:#"data"];
NSLog(#"data=%#",data);
NSArray *results = [data valueForKey:#"weather"];
NSLog(#"weather=%#",results);
NSArray *results1 = [results valueForKey:#"tempMaxC"];
NSLog(#"tempMaxC=%#",results1);
NSArray *results2 = [results1 valueForKey:#"weatherIconUrl"];
NSLog(#"weatherIconUrl=%#",results2);
The problem is that when i get the WeatherIconUrl it comes with this format
"http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
and i cant get the url itself without the quotation marks, i tried using nsrange and componentsSeparatedByString but it always gives me this error:
[__NSArrayI componentsSeparatedByString:]: unrecognized selector sent to instance
JSON from server:
{
"data": {
"current_condition": [
{
"cloudcover": "0",
"humidity": "73",
"observation_time": "12:19 PM",
"precipMM": "0.0",
"pressure": "1021",
"temp_C": "23",
"temp_F": "73",
"visibility": "10",
"weatherCode": "113",
"weatherDesc": [
{
"value": "Sunny"
}
],
"weatherIconUrl": [
{
"value": "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
}
],
"winddir16Point": "NW",
"winddirDegree": "320",
"windspeedKmph": "17",
"windspeedMiles": "11"
}
],
"request": [
{
"query": "Fanzeres, Portugal",
"type": "City"
}
],
"weather": [
{
"date": "2012-09-12",
"precipMM": "0.0",
"tempMaxC": "28",
"tempMaxF": "83",
"tempMinC": "17",
"tempMinF": "63",
"weatherCode": "113",
"weatherDesc": [
{
"value": "Sunny"
}
],
"weatherIconUrl": [
{
"value": "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
}
],
"winddir16Point": "NW",
"winddirDegree": "312",
"winddirection": "NW",
"windspeedKmph": "16",
"windspeedMiles": "10"
},
{
"date": "2012-09-13",
"precipMM": "0.0",
"tempMaxC": "33",
"tempMaxF": "91",
"tempMinC": "17",
"tempMinF": "63",
"weatherCode": "113",
"weatherDesc": [
{
"value": "Sunny"
}
],
"weatherIconUrl": [
{
"value": "http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"
}
],
"winddir16Point": "N",
"winddirDegree": "8",
"winddirection": "N",
"windspeedKmph": "10",
"windspeedMiles": "6"
}
]
}
}
Sorry for my bad english and please correct me if im doing this wrong, thanks in advance
use objectForKey instead of valueForKey when getting the array from #"weatherIconUrl" then get the string into NSString e.g.
NSString *weatherIconUrlString = [results2 objectAtIndex:0]
to check that this is a valid url, use the canHandleRequest method of NSURLConnection, e.g.
NSURL *url = [NSURL URLWithString:weatherIconUrlString];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url
BOOL canGo = [NSURLConnection canHandleRequest:request];
If you truly have quotes surrounding your URL, then try something like this:
NSString *someURLString = [results2 objectAtIndex:0];
NSString *quotesRemoved = [someURLString stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:#"\""]];
putting the server's output through jsonLint.com gives an easier to read format of the json.
The code below now gets the weather icon url as required. It assumes the json has been downloaded as an NSData object called jsonData, and doesn't check for which date the data refers to.
NSError *error = nil;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves
error:&error];
NSArray *data = [jsonDict valueForKey:#"data"];
NSArray *weather = [data valueForKey:#"weather"];
NSArray *weatherIcon = [[weather objectAtIndex:0] valueForKey:#"weatherIconUrl"];
NSString *url = [[weatherIcon objectAtIndex:0] valueForKey:#"value"];
The resulting url is used in an NSURLRequest and shown in a webview

parsing json in iphone

I ve got a twitter json Feed.the thing is i m getting error while parsing the json feed .i m using jsonkit.below is the json url.i want to parse the value text and profile_background_image_url in the below json feed.cud u guys help me out
[
{
"created_at": "Mon Jul 09 21:46:49 +0000 2012",
"id": 222446736654872580,
"id_str": "222446736654872576",
"text": "#mevru you have to go to : http://t.co/pPGYijEX",
"source": "web",
"truncated": false,
"in_reply_to_status_id": 222445085235752960,
"in_reply_to_status_id_str": "222445085235752961",
"in_reply_to_user_id": 146917266,
"in_reply_to_user_id_str": "146917266",
"in_reply_to_screen_name": "mevru",
"user": {
"id": 145125358,
"id_str": "145125358",
"name": "Amitabh Bachchan",
"screen_name": "SrBachchan",
"location": "Mumbai, India",
"description": "Actor ... well at least some are STILL saying so !!",
"url": "http://srbachchan.tumblr.com",
"protected": false,
"followers_count": 3022511,
"friends_count": 415,
"listed_count": 22016,
"created_at": "Tue May 18 05:16:47 +0000 2010",
"favourites_count": 10,
"utc_offset": 19800,
"time_zone": "Mumbai",
"geo_enabled": false,
"verified": true,
"statuses_count": 14166,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "BADFCD",
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/144221357/t-1.gif",
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/144221357/t-1.gif",
"profile_background_tile": true,
"profile_image_url": "http://a0.twimg.com/profile_images/2227330575/Amitji_normal.png",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2227330575/Amitji_normal.png",
"profile_link_color": "FF0000",
"profile_sidebar_border_color": "F2E195",
"profile_sidebar_fill_color": "FFF7CC",
"profile_text_color": "0C3E53",
"profile_use_background_image": true,
"show_all_inline_media": true,
"default_profile": false,
"default_profile_image": false,
"following": null,
"follow_request_sent": null,
"notifications": null
}
following is the ios code that i used to parse
jsonurl=[NSURL URLWithString:#"https://api.twitter.com/1/statuses/user_timeline.json?screen_name=#SrBachchan&count=10"];
jsonData=[[NSString alloc]initWithContentsOfURL:jsonurl];
jsonArray = [jsonData objectFromJSONString];
items = [jsonArray objectForKey:#"text"];
NSLog(#"the given text:%#",items);
story = [NSMutableArray array];
title = [NSMutableArray array];
picture = [NSMutableArray array];
for (NSDictionary *item in items )
{
}
The problem is in this line:
items = [jsonArray objectForKey:#"text"];
As your code suggest it's an array not a dictionary thus you have grab the object from the array first:
for (NSDictionary *item in jsonArray ) {
NSDictionary *user = [item objectForKey:#"user"];
NSString *imageURLString = [user objectForKey:#"profile_image_url"];
}
NSData *data = [NSData dataWithContentsOfURL:jsonurl];
NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
if (!array) return;
NSDictionary *dictionary = [array objectAtIndex:0];
if (dictionary){
NSString *text = [dictionary valueForKey:#"text"];
NSString *profileBackgroundImageURL = [dictionary valueForKeyPath:#"user.profile_background_image_url"];
}
Use jsonlint.com to validate your JSON.
The error is lacking of the last closing operand } at the end of JSON string.
There're 2 opening but only one closing.
Parse error on line 52:
...cations": null }
----------------------^
Expecting '}', ',', ']'
Try this
items = [[jsonArray objectAtIndex:0] objectForKey:#"text"];
backImage=[[[jsonArray objectAtIndex:0] objectForKey:#"user"] objectForKey:#"profile_background_image_url"] ;

How to fetch data from this specific json (iphone)

Can anyone tell me how to find the model from this ?
it is giving me null all the time
{
"Status": 200,
"Data": [
{
"id": "1",
"custno": "0000235",
"locno": "00001",
"mfg": "KABA-MAS",
"model": "Cencon Gen II",
"serial": "GF8912",
"install": "2011-10-01",
"removed": "0000-00-00",
"warranty": "2012-01-10",
"seragrno": "A",
"equiploc": "Testing",
"notes": "This is a test lock to test our system. I this is it good.",
"invoice": "A",
"eqtype": "Lock",
"plan": "1",
"status": "0",
"image": "cencon_main_1318703242.gif",
"pmrequired": "1",
"locktime": null,
"lockby": null,
"pmrequiredText": "Yes",
"statusText": "Active",
"planTypeText": "Plan I"
},
{
"id": "2",
"custno": "0000235",
"locno": "00001",
"mfg": "adsdad",
"model": "",
"serial": "",
"install": "2011-10-24",
"removed": "0000-00-00",
"warranty": "0000-00-00",
"seragrno": "",
"equiploc": "",
"notes": "",
"invoice": "",
"eqtype": "",
"plan": "",
"status": "-1",
"image": "",
"pmrequired": "0",
"locktime": null,
"lockby": null,
"pmrequiredText": "No",
"statusText": "Pending",
"planTypeText": null
}
]
}
I am not sure...but there should be some obj.value type of structure, like in javascript
u can access it using something like "responce.data.model"
assuming the JSON has been turned into an NSDictionary:
NSArray *items = [dictionary objectForKey:#"Data"];
for (item in items) {
NSLog(#"model = %#", [item objectForKey:#"model"]);
}
If you are looking for how to turn the JSON into an NSDictionary try:
iPhone/iOS JSON parsing tutorial
try this :
NSData *responseData;
NSMutableDictionary *response ;
NSString *urlStr = [NSString stringWithFormat:#"http://www.example.com"];
NSLog(#"%#",urlStr);
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *json = [[[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding] autorelease];
response = (NSMutableDictionary *)[json JSONValue];
Then you'll have dictionary response. Now you can access it as
NSLog(#"%#",[response valueForKey:#"Data"] objectAtIndex:yourIndexValue] valueForKey:#"model"]);
Use SBJsonParser for parsing the response.
And "data" field is array of dictionary.
SBJsonParser *parser = [[SBJsonParser alloc] init];
// parsing the JSON
NSMutableDictionary *jsonDictionary = [parser objectWithString:response];
NSMutableArray *dataArray = [jsonDictionary objectForKey:#"data"];
So, u can use something like this:-
for(NSMutableDictionary *tempDictionary in dataArray)
{
NSLog(#"id is %#",[dataArray objectForKey: #"description"]);
}

Facebook sdk for ios read fan page wall

i want to read my fan page wall from my iPhone application, how i can do ?
Now i have this code for parse the graph api:
-(IBAction)parsing:(id)sender{
[facebook requestWithGraphPath:#"PAGE_ID/feed" andDelegate:self];
}
- (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
NSLog(#"received response");
}
- (void)request:(FBRequest *)request didLoad:(id)result {
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
}
// NSArray *data = [result objectForKey:#"data"];
NSArray *from = [result objectForKey:#"from"];
if ([result objectForKey:#"from"]) {
for (NSDictionary *name in from) {
NSString *myName = [name objectForKey:#"name"];
[self.label2 setText:myName];
NSLog(#" Log: ", myName);
}
But don't work because he don't parse:
The json file i want to parse is this:
{
"data": [
{
"id": "105744066144184_231235146928408",
"from": {
"name": "Alberto ####",
"id": "1000013568710###"
},
"to": {
"data": [
{
"name": "########",
"category": "News/media",
"id": "##########"
}
]
},
"message": "\u00e8######################################",
"type": "status",
"created_time": "2011-09-02T18:30:59+0000",
"updated_time": "2011-09-02T18:30:59+0000",
"likes": {
"data": [
{
"name": "Luca #####",
"id": "###########"
}
],
"count": 1
},
"comments": {
"count": 0
}
ecc..
I use
NSArray *list = [result valueForKey:#"data"];
for (NSDictionary *dic in list) {
NSLog(#"id : %#",[dic valueForKey:#"id"]);
NSLog(#"type : %#",[dic valueForKey:#"type"]);
if ([[dic valueForKey:#"type"] isEqualToString:#"status"]) {
NSLog(#"- message : %#",[dic valueForKey:#"message"]);
}else if([[dic valueForKey:#"type"] isEqualToString:#"link"]){
NSLog(#"- link : %#",[dic valueForKey:#"link"]);
}else if([[dic valueForKey:#"type"] isEqualToString:#"photo"]){
NSLog(#"- icon : %#",[dic valueForKey:#"icon"]);
NSLog(#"- message : %#",[dic valueForKey:#"message"]);
}
NSLog(#"------");
}
adaydesign :)