ios中id和NSInteger比较

从服务器获取的json数据,通过调用dictionary中的objectForKey方法,返回的是一个id类型数据,需要比较这个数据是否为0,所以需要转化成NSInteger

方法:

NSInteger questionId = [[newQuestion objectForKey:@"question_id"] integerValue];
http://stackoverflow.com/questions/6474679/objective-c-convert-id-to-nsinteger

posted @ 2013-10-22 16:43  时光独白  阅读(723)  评论(0)    收藏  举报