in my code there is exception:
this is my code
This is my data
plz help me to solve it i search to find way to solve it but didn't found result.
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objectForKey:]: unrecognized selector sent to instance 0x6133a70'
this is my code
Code:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[buffer setLength:0];}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[buffer appendData:data];}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *str = [[[NSString alloc] initWithData:buffer encoding:NSUTF8StringEncoding] autorelease];
NSArray *array = [str JSONValue];
if (!array)
return;
NSDateFormatter *fmt = [[[NSDateFormatter alloc] init] autorelease];
[fmt setDateFormat:@"yyyy-MM-dd"];
for (NSDictionary *dict in array) {
NSLog(@"Class of eve_date = %@", [[dict objectForKey:@"eve_date"]class]);
NSDate *d = [fmt dateFromString:[dict objectForKey:@"eve_date"]];
NSLog(@"%@",d);
[eventPHP addObject:[Events eventsNamed:[dict objectForKey:@"title_event"] description:[dict objectForKey:@"description"] date:d]];
}
}
This is my data
{"event":[{"eve_date":"2011-12-24","eve_time":"1 pm","title":"Tooth Regeneration Research","decription":"Tooth Regeneration Research:Where Do we stand today?\r\n\r\nBy: Dr.Tarek H El-Bialy,phD,FRCD(c)\r\n\r\nvenue:VIP ROOM,college of Dentistry,KSU"},{"eve_date":"2011-12-21","eve_time":"8 am","title":"The First Knowledge Translation(KT)","decription":"The First Knowledge Translation(KT)symposium in saudi Arabia\r\n\r\nvenue: main Auditorium,college of medicine\r\n\r\nFor Registration and further inquiries please concat:\r\n\r\nTel:4690790\/Email:ebhc-kt@ksu.edu.sa"}]}
plz help me to solve it i search to find way to solve it but didn't found result.